procmail
[Top] [All Lists]

Re: chmod immediately?

1997-07-15 20:03:00
        Author: Dave/WebMaster <ddave(_at_)ddave(_dot_)com>
        Date: Sun, 13 Jul 1997 21:43:03 -0700 (PDT)
        Message-ID: 
<Pine(_dot_)BSD(_dot_)3(_dot_)91(_dot_)970713213608(_dot_)13233C-100000(_at_)almond(_dot_)elite(_dot_)net>

echo "<<h1>END of WEB<</h1>" >> $WEB/$FILE.html && chmod a+r
$WEB/$FILE.html
^^

I'm lost here. Why the && ?


the && tells it to do the second only if the first succeeds (ie exits with 
code=0)

you could do this:

echo "<<h1>END of WEB<</h1>" >> $WEB/$FILE.html

exit=$?

if [ "$exit" = "" ]
then
        chmod a+r $WEB/$FILE.html
else
        echo "Can't chmod $WEB/$FILE.html (exitcode = $exit)"
        exit 1
fi


but it's much easier to do

echo "<<h1>END of WEB<</h1>" >> $WEB/$FILE.html && \
chmod a+r > $WEB/$FILE.html

the "&&" is better than the ";" because the ";" ignores the exitcode of the  
echo line....           

TjL

ps -- setting the proper umask is definitely the way to go...

<Prev in Thread] Current Thread [Next in Thread>