How should a backslash resulting from variable expansion be treated?
问题 I ran the following command ( *sh being the name of a sh implementation) with all the shells I could find; although I was expecting all to print match , I got inconsistent results. I don't know which behavior is correct and reliable. *sh -c 'case "$1" in $2) echo match; esac' _ 'f\oo' 'f\\oo' With dash from Ubuntu bionic's repo (and ash; which is a symbolic link to dash) $ dash -c 'case "$1" in $2) echo match; esac' _ 'f\oo' 'f\\oo' match With bash 4.4.20(1)-release (x86_64-pc-linux-gnu) and