Indeed the use of double quotes around "$FLAG" prevents the expansion of the wildcard. They can be left out, but then the test will fail if there are more files present with this pattern. To test for the presence of one of more files you could try:
---
Quote:
Originally Posted by Don Cragun
Try any one of:
That should not be necessary, since wildcards are not expanded in variable assignments...
Last edited by Scrutinizer; 08-27-2014 at 04:54 AM..
I'm writing a script that will ssh to a number of hosts and run commands. I'm a bit stumped at the moment as some of the commands that I need to run contain wildcards (i.e. *), and so far I have not figured out how to escape the * character so the script doesn't expand it. More specifically, here's... (9 Replies)
I am using a shell script to read SQL statements stored in a DB2 table and write them out to a file. The problem I have is that some SQL statements have an "*" in them which gets resolved as the list of files in the current directory when I run the script. How can I prevent the "*" from being... (7 Replies)
I was trying to replace a string ( for eg - @@asterisk@@ to * ) in variable using
cat $INFILE | while read LINE
do
stmt1=`echo $LINE | sed 's/@@asterisk@@/\*/g'`
stmt=$stmt' '$stmt1
stmt2=`echo $LINE`
STATEMENT=$STATEMENT' '$stmt2
done
echo 'Statement with sed -- > '... (5 Replies)