Quote:
Originally Posted by bubai70
Hi
past few days I have been working with linux script but I stuck while I read assign value chapter. Kindly explain the difference between all 3 below:
1) var1="this is a variable" [working]
2) var2=this is a variable [not working]
3) read var1 <= enter [working]
what ever you can type here without quotes it will will work
|
You have to consider what is being parsed as a command line.
Case #2 is parsed as, "Invoke a command named '
is' with arguments '
a' and '
variable' and with '
var2=this' in the environment."
In case #3, the entire command line is "
read var1". What you type in the next line is just text input to the "
read" command, which parses its input according to its own rules, which are not the same as command line parsing (about all it shares with command line parsing is word splitting and backslash escapes).