I am new to UNIX and currently working on a shell script where I will be receiving files with names such as abc_123_date.zip
so the file names will be abc_123_12312005
. Instead of hardcoding abc_123_*.zip
in commands such as find
and if [ -f ... ]
all over, I plan to store that string in a variable and then use it. For example:
file_name=abc_123_*.zip
And then in rest of the sections of the code I can use $file_name
instead of the actual string for any and all operations which requires that string.
What is the best way to store that string:
Option 1: file_name=abc_123_*.zip
Option 2: file_name="abc_123_*.zip"
Which is the better option? and why?
Thanks!
=
does not look right. Is it OK onksh
? It is not in bash. (I can't see how it could reliably parse it).