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

Re: small if statement in shell script



On 6/22/05, michael@etalon.net <michael@etalon.net> wrote:
> I have an if statement, something like:
> 
> if [ "$day" = "Thu" ]; then
> tar -cpf /var/backups/homethu.tar /home
> fi

Try the following:

if [ "$day" = "Thu" ]; then
tar -cpf /var/backups/homethu.tar /home
:
fi

If you comment out the tar command, the shell will still see the
(empty) ":" command, thus keeping "if" happy.

-- 
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com



Reply to: