View Single Post
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#3
Secondarily, there are shell scripting use cases where esceval (or something like it) is helpful and would make code more legible, even though it's not necessary.

Specifically where you have to pass complex strings (especially other shell commands) as arguments to some tool (e.g. if I want to run the find command, but I need to pass a not-trivial shell command to its '-exec' arguments, of I want to launch X-Term from a shell script and have it run some commands visible to the user in the console). May the shell script gods be merciful so that you never have to nest shell commands like that several levels deep.

In those cases, now that I have esceval, I would define a variable containing the legible, 'first-order' text of that to-be-nested shell command, then esceval it to encapsulate it in however many levels of shell escaping I need (e.g. FOO=[fancy shell script]; FOO=`esceval "$FOO"`; ... ), then substitute the final escaped result where it's needed.
__________________
If you want to donate in support of anything that I do, you can do so with either of these options:
PayPal | Bitcoin: 1J4XG2z97iFEKNZXThHdFHq6AeyWEHs8BJ | [Will add other donation options eventually]
 

The Following 2 Users Say Thank You to Mentalist Traceur For This Useful Post: