1

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

1 Answer 1

3

Use double quotes:

VAR1=hello\ world
#... do something else
./a_script.sh "$VAR1"
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.