Artificial intelligent assistant

Dash print expanded commands Running _xtrace_ or _set -x_ with Bash will print the expanded command: $ bash -xc 'touch "alfa bravo"' + touch 'alfa bravo' However Dash does not print the command that is actually run: $ dash -xc 'touch "alfa bravo"' + touch alfa bravo The printed command appears to create 2 files, while the command actually creates 1. Can Dash be made to print the commands that are actually run?

This is a pretty awful workaround, but seems to do the trick:


BEGIN {
w = "\47"
while (++i < ARGC) {
x = split(ARGV[i], y, w)
for (each in y) {
if (y[each] ~ /[^[:alnum:]%+,./:=@_-]/)
printf w y[each] w
else
printf y[each]
if (each < x)
printf "\\" w
}
if (i == ARGC - 1)
printf RS
else
printf FS
}
}


Result:


$ awk -f charlie.awk touch "alfa bravo"
touch 'alfa bravo'

$ awk -f charlie.awk touch 'alfa"bravo'
touch 'alfa"bravo'

$ awk -f charlie.awk touch "alfa'bravo"
touch alfa\'bravo

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 4d072fd60597a7d615871b60bc1eb5b2