Reputation: 1
for a script
script.sh < a b c a
I want to put the inputs in one string, like that
string=" a b c a"
ie, preserve the spaces
how can i do that?
thanks
Upvotes: 0
Views: 51
Reputation: 75558
Consider using here documents and here strings.
script.sh:
#!/bin/bash
readarray -t INPUT
printf "input: %s\n" "${INPUT[@]}"
example:
bash script.sh <<< "a b c"
Upvotes: 1