I am having a challange to pass the asterisk in the variable. Basically, I am writing a shell script to check if a marker file exists but when I am assigning the varialbe it cannot use the wildcard asterisk as expected, therefore, my program is always outputs "Marker file is not arrived". Can someone pease help me how do I get it correct.
Marker file will arrive as Marker_YYYYMMDD.tmp but I would like to define it as below ...
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 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)
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'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)