[ale] Bash scripting question #2
Geoffrey
esoteric at 3times25.net
Fri Feb 18 06:57:36 EST 2005
Dow Hurst wrote:
> So the || in the do loop says to only execute the echo if the test of
> the link being a file that exists returns true?
No, it's a logical or. The point is that even though the sym link
exists, if you test for existance of the file, and the file is not
there, it will return false.
To test to see if it's a sym link you would do
test -L foo
>
> I have a script that I'd like to have watch 10 files and when the last
> one is removed, then move on to the next command in the script. I
> initially tried testing for the existence of all 10 files but I know I
> have the syntax wrong.
>
> Here is the while loop that failed:
>
> ## Wait and watch for locks to disappear
> cd $CWD
> LK=biased.lck
> TERM="BatchMin normal termination"
>
> while :
> do
>
> if [ -f $CWD/00/biased/$LK || $CWD/01/biased/$LK ||
> $CWD/02/biased/$LK || $CWD/03/biased/$LK || $CWD/04/biased/$LK \
> || $CWD/05/biased/$LK || $CWD/06/biased/$LK ||
> $CWD/07/biased/$LK || $CWD/08/biased/$LK || $CWD/09/biased/$LK ]
You want to use:
if [ -f foo -o -f bar -o -f foobar ]; then doit; fi
Different syntax inside the brackets.
--
Until later, Geoffrey
More information about the Ale
mailing list