Hello I need to alter a script to check for a flag file but there are now more than one type of flag file in my directory. Basically if any of these flg files exist then the MASK value should be set? Flag files to be included in assignment to variable
e2e_scheduled*.flg
COLL_STOP*.flg
contracted_coll*.flg
Original assignment
MASK=*.flg
New assignment would this work?
MASK = e2e_scheduled*.flg, COLL_STOP*.flg,contracted_coll*.flg
I'm a little unclear what you are trying to acheive. Here are my thoughts on what I think you may be looking for:-
Is it just to detect if a file of that name exists?
if [ -r *.flg ]
then
echo "Hit"
else
echo "Miss"
fi
If you want a list of files to loop through:-
for file in *.flg
do
MASK=1 # Or whatever you want to set it to
whatever
done
If you want to assign all the names for files to the variable MASK
comma seaparated:-
for file in *.flg
do
MASK="$MASK,$file"
done
MASK="${MASK#,}" # Remove leading comma
Am I anywhere near your requirement?
Robin
Liverpool/Blackburn
UK