I'm writing a shell script at the moment and its all quite new, and I've been reading around unix.com and google for a good few hours, but can't figure out how to check if a file exists with a certain prefix..
basically i have a directory with some files:
ABC1
ABC2
ABC3
etc..
and want to do:
and the code in my script looks like:
the thing is ABC files already exist in the directory: ABC1, ABC2 etc.. but it always goes into the ELSE part of the IF statement...
even if i hard code the filename to ABC1 which does exist, the IF statement still fails.....
any help from you guys would be really appreciated.
thanks
basically i have a directory with some files:
ABC1
ABC2
ABC3
etc..
and want to do:
Code:
if [file exists with prefix ABC*] then
do something
else
do something else
fi
and the code in my script looks like:
Code:
if [-e ABC*]; then
do something
else
do something else
fi
the thing is ABC files already exist in the directory: ABC1, ABC2 etc.. but it always goes into the ELSE part of the IF statement...
even if i hard code the filename to ABC1 which does exist, the IF statement still fails.....
any help from you guys would be really appreciated.
thanks