Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] testing for file existanace, and an 'and' in a script


Voytek Eymont wrote:

I want to check if two files exists, if so, run awstats, how do I put an
'and', and, is that the way to check it ?


if [ -s /home/$DOMAIN/logs/2004-$j-$i-access.rog ] AND [ -s
/etc/awstats/awstats.www.$DOMAIN.conf ]; then
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl  -config=www.$DOMAIN -update
fi

Voytek
It's "-a", e.g.:

<>if [ -s /home/$DOMAIN/logs/2004-$j-$i-access.rog -a -s
/etc/awstats/awstats.www.$DOMAIN.conf ]; then
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.$DOMAIN -update
fi

See "man test" as this is the program which is aliased to "[" (by means of having
a symbolic link from /usr/bin/[ to /usr/bin/test).

HTH,

--Amos