Let’s say I have a Bash script called foo.sh.
I’d like to call it like this:
foo.sh Here is a bunch of stuff on the command-line
And I’d like it to store all of that text into a single variable and print it out.
So my output would be:
Here is a bunch of stuff on the command-line
How would I do this?
would do what you want, namely printing out the entire command-line arguments, separated by a space (or, technically, whatever the value of
$IFSis). If you wanted to store it into a variable, you could doIf that doesn’t answer your question well enough, I’m not sure what else to say…