Whats the basic difference between double inverted comma and single inverted comma and no comma applied at all?
Eg1 if [ -f "$filename" ]
Eg2 if [ -f $filename ]
iEg3 f [ -f '$filename' ]
Whats the basic difference between double inverted comma and single inverted comma and no comma applied at all?
Eg1 if [ -f "$filename" ]
Eg2 if [ -f $filename ]
iEg3 f [ -f '$filename' ]
' is a tic or tic-mark or single quote
" is a double quote
quotes affect how the shell treats a variable.
if [ -f $filename ] translates $filename - if it has spaces the shell "thinks" $filename
is really separate values with no spaces
if [ -f "$filename" ] translates $filename - if it has spaces the shell "thinks" $filename
is realy one single value, spaces included
if [ -f '$filename' ] does not translate filename - the shell takes the $ literally, not
as a shell token meaning return the value of a variable