Re: rm -rf $Home (was GNOME hangs)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2006-08-06 at 13:55, Kwan Lowe wrote:

> Actually as the above command is written, it would have deleted everything under /,
> not /root. $Home is not set, but $HOME.
> 
> I've seen some scripts with the following:
> 
> LOGDIR=/var/log/myapp
> cd $LOGDIR
> rm -rf *
> 
> If for some reason LOGDIR is inaccessible then the script owners $HOME is likely to
> be trashed. On some systems where root's home is not /root, then likely everything
> in / gets trashed.

Long, long ago (circa SysVr2) the bourne shell would exit when
in a non-interactive script and a cd failed.  It was a good
idea but I guess it was too complicated to always get the
script vs. interactive part right.   Now you need to
write
cd /path || exit 
if it doesn't make sense to continue.

-- 
  Les Mikesell
   lesmikesell@xxxxxxxxx



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux