I'm trying to echo a combination of text and variables containing wildcards that I need "unpacked", but I encountered the following behavior:
If I say:
FILENAME=somefile*.txt
echo "something:" $FILENAME
I get:
something: somefile003.txt
Which is what I want, but if I say: If I say:
FILENAME=somefile*.txt
echo "something:"$FILENAME
I get:
something:somefile*.txt
So it seems like if there is no space between quotes and the variable it doesn't glob the wildcard. Is there a way to get it to process the * without adding a space?
something:somefile*.txt. – DopeGhoti Jul 24 '17 at 18:09FILENAME = somefile*.txtyour shell will try to execute a program calledFILENAME. If you sayFILENAME=somefile*.txtyour shell will set a variable calledFILENAME. Please be precise; it's important. – Chris Davies Jul 24 '17 at 18:11FILENAMEwould not have been assigned to something which could have globbed. – DopeGhoti Jul 24 '17 at 18:15printf "something:%s\n" $FILENAME. – jimmij Jul 24 '17 at 18:16