On 3/1/22 7:07 PM, Gordon Messmer wrote:
On 3/1/22 15:36, Robert Nichols wrote:
"${cmdline[@]}"
The problem there is that the last line is going to get interpreted by a shell before anything is executed, so you now have to escape characters that are special to the shell within a quoted string. This is unlike the compiled fstab-decode program that invokes the execvp() library call and avoids further shell parsing.
Does it, though?
$ bash fstab-decode.sh echo '$PATH' $PATH $ bash fstab-decode.sh ls '*' ls: cannot access '*': No such file or directory
After study, the only types of expansion that occur _after_ parameter expansion are word splitting and pathname expansion, and those are both protected by the double quotes. So, I guess it's OK.