[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: meta char in [ -f xxxx ] test
From: |
Bob Proulx |
Subject: |
Re: meta char in [ -f xxxx ] test |
Date: |
Sat, 23 Jun 2001 18:25:50 -0600 |
> Is there a way to get wild character support in the file-exist test =
> expression, I was able to do this in SCO's sh shell, but bash on linux =
> doesnt seem to support it.
> For example:
> if [ -f mystuff*.zip ]
> then
> echo "mystuff files exist"
> fi
> Paul Meyers
> Systems Administrator
> Community Computer Service
> 15 Hulbert St.=20
> Auburn, NY 13021
> Ph (315) 255-0900 Fx (315) 255-0416
I suggest using the portable syntax of a for loop.
for i in mystuff*.zip; do
if [ -f "$i" ]; then
echo "mystuff files exist"
fi
done
Or if want more terse copy:
for i in mystuff*.zip; do
test -f "$i" && echo "mystuff files exist"
done
Bob