I want to write a script foo
which simply calls bar
with the exact same arguments it was called with, using Bash or Perl.
Now, a simply way to do this in perl would be
#!/bin/perl
my $args=join(' ', @ARGV);
`bar $args`;
However, the values in ARGV have already been processed by the shell, thus if I call
foo "I wonder, \"does this work\""
bar would get called like this
bar I wonder "does this work"
How can I obtain the original command line so that I can simply pass it on verbatim?