Just another Perl shrine | |
PerlMonks |
Re: preserve quotes after $0 + @ARGV interpolationby bliako (Monsignor) |
on Dec 13, 2019 at 14:52 UTC ( [id://11110073]=note: print w/replies, xml ) | Need Help?? |
Another way: write your own command launcher. That can just be a basic unix shell, e.g. see here https://www.geeksforgeeks.org/making-linux-shell-c/ or modify bash as I suggest in one of my answers to you below. Here is a basic command launcher in Perl. WARNING: it is not secure to execute user input!
It will first log what you wrote without interpolation or checking if quotes balance, etc. Then it can pass what you write to the default shell for interpolating it, breaking it into separate command line arguments and then finally launching your command with these arguments.
Or it can pass what you write to bw, bliako EDIT: don't be scared by the "one huge command line parameter" I mentioned above, because Getopt::Long can parse it as a single string (as opposed to an ARGV-style array, which also does parse really beatifully).
In Section
Seekers of Perl Wisdom
|
|