3 ms·
> Why is shell quoting still so hard? The problem with the awk example here specifically is that you're mixing two different languages (shell and awk), and tha
by Beltalowda 4y ago
> Why is shell quoting still so hard?
The problem with the awk example here specifically is that you're mixing two different languages (shell and awk), and that's always going to be painful to a degree. Doing something like running Python code directly from a Ruby script also isn't fun, especially not if you want Python variables in that Ruby script.
And to make it extra fun in the ssh you're also adding a second shell (on the system you're sshing to), so you have to think about 1) your machine's shell, 2) the host's shell, and 3) awk.
So yeah ... that's going to be tricky, but in this case it's not really a shell problem as such.
- haroldp 4y ago> The problem with the awk example here specifically is that you're mixing two different languages (shell and awk) Two languages, but three environments altogether. I'm running an awk script, in a remote shell script, in a local shell script. So a string with a meta-character or keyword within the awk script needs to be triply escaped. And there's no shell_escape(shell_escape(awk_escape(a literal dollar one $1))) available to make it less painful.