Reputation: 13244
Think you have a variable that contains a string of text with spaces inbetween and you want to use that as input arguments for another script. How would you go about passing the variable content without worrying about the space chars?
The following doesn't work:
VAR1=hello\ world
#... do something else
./a_script.sh $VAR1
Upvotes: 1
Views: 211
Reputation: 161604
Use double quotes:
VAR1=hello\ world
#... do something else
./a_script.sh "$VAR1"
Upvotes: 3