XP is just a number | |
PerlMonks |
Re: preserve quotes after $0 interpolationby bliako (Monsignor) |
on Dec 13, 2019 at 07:02 UTC ( [id://11110052]=note: print w/replies, xml ) | Need Help?? |
quoting @ARGV items back could be a challenge only when they are quoted. Otherwise quote them with single quotes, since bash had already interpolated anything that should had been interpolated. In the case there are quotes, I have not given it too much thought, but this can quote back your command line to equivalent effect to the original (but not the same):
Assuming bash. If you find you need a lot of tweaking and extra cases handling then the path you are following is the wrong one and you probably do not need the actual command line verbatim. btw, $0 holds your command and @ARGV your command arguments. bw, bliako p.s. at the time of writing this, ikegami suggested something more robust because it uses an existing module (with probably all the edges covered). What the heck! Every time a one-liner is thrown away a sailor is drowned in the high seas, so here you go.
In Section
Seekers of Perl Wisdom
|
|