I am making a bash script that will print and pass complex arguments to another external program.
./script -m root@hostname,root@hostname -o -q -- 'uptime ; uname -a'
How do I print the raw arguments as such:
-m root@hostname,root@hostname -o -q -- 'uptime ; uname -a'
Using $@
and $*
removes the single quotes around uptime ; uname -a
which could cause undesired results. My script does not need to parse each argument. I just need to print / log the argument string and pass them to another program exactly how they are given.
I know I can escape the quotes with something like "'uptime ; uname -a'"
but I cannot guarantee the user will do that.