1 year ago
#384558
wowza_MAN
Multi line Parameter Overrides Following Parameter - Bash
I have a bash script that takes input of a multiline string from another bash script. For example it may look something like this
hello
world
if I assign the above string to a variable and pass it as a parameter to my script along with other variables
script.sh $multi_line_string $foo $bar
in my other script, script.sh ill have some like the below snippet to get the parameters and assign them to a variable
multi_line=$1
foo=$2
bar=$3
but the values of each will be
multi_line = hello
foo = world
bar = foo
and what im looking for is in script.sh is to have the full string inside of the multiline variable
multi_line = hello
world
foo = foo
bar = bar
I understand why this is happening but I want to know how I can prevent the newlines in the variable from being interoperated as another parameter instead of just the one.
bash
unix
quotes
0 Answers
Your Answer