[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] bash scripting question
- Subject: [ale] bash scripting question
- From: esoteric at 3times25.net (Geoffrey)
- Date: Wed Sep 10 19:55:36 2003
- In-reply-to: <[email protected]>
- References: <[email protected]>
Kevin Krumwiede wrote:
> I need a boolean statement that will evaluate to true if one or more
> files matching a wildcard exist. I tried [ -f ... ], it works if
> there is exactly one matching file, but not if there are more.
You can't use wild card char. in the [ -f .. ], your best bet is a case
statement.
You could do it with a for loop:
for fn in fn1 fn2.....fnN; do
if [ -f $fn ]; then
# do what you want to for the match here then break the loop
break;
fi
done
--
Until later: Geoffrey esoteric at 3times25.net
The latest, most widespread virus? Microsoft end user agreement.
Think about it...