I am updating bash on our embedded platform from 4.1.9 to the latest (4.4.12), and I am seeing a behaviour change in this simple scenario of passing escaped arguments into a script.
#! /bin/sh echo "ARG |$*|"
And I invoke the script like this:
bash -c "/tmp/printarg \\"abc\\""
I've tried this on several platforms (native x86_64 Linux) running bash 4.3.42, as well as several embedded platforms (ARM and PPC) running bash 4.1.9 and 4.2.37, and all of these platforms report what I would expect:
38$ bash -c "/tmp/printarg \\"abc\\"" ARG |abc|
But, when I run this using bash 4.4.12 (native X86 or embedded platforms), I get this:
$ bash -c "/tmp/printarg \\"abc\\"" ARG |abc\| <<< trailing backslash
And if I add a space in the command line between the second escaped quote and the ending quote, then I no longer see the extra backslash:
$ bash -c "/tmp/printarg \\"abc\\" " ARG |abc | <<< trailing space, but backslash is gone
This feels like a regression. Any thoughts? I also did try enabling the various compat options (compat40, compat41, compat42, compat43) with change.