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

Re: local updatedb files ... [Was: Finding files not present]



David B. Teague wrote:

> > On my stand-alone machine at home, I get all files by making this change
> > to /etc/cron.daily/find:
> >
> > #cd / && updatedb --localuser=nobody 2>/dev/null
> > cd / && updatedb 2>/dev/null

> BTW Please explain why the && is present in the script!  I have never
> understood what that is doing...

I'm no wiz shell programmer, but the && means "and", such that the
second command (updatedb) is _not_ executed if the first command fails.
Likewise, there is a "||" operator. See man sh, man bash, etc. 

Consider this disaster I saw once:

A cron job executed this:
      cd /tmp/tempstuff
      rm -r *

Well, this got run a machine where the directory /tmp/tempstuff did not
exist. Well, the rm ran from "/" instead. It even cleaned out nfs
mounted directories...

A use of the "&&" is this:
      cd /tmp/tempstuff && rm -r *
      
-- 
...RickM...


Reply to: