I want to keep the escaping of quotes in a bash function:
foo () { echo $@; }
The function above will print the arguments passed to it:
$ foo -a bar
-a bar
This is fine, but when I pass quotes I want to keep them in one argument:
$ foo -l 'bar' -m "asd asd"
-l bar -m asd asd
I expected:
-l bar -m "asd asd"
How can I do that?
I tried to put $@
between quotes: "$@"
, also I tried to pass the $*
variable, none of them working on my expectation.