On Fri, Jan 04, 2019 at 01:43:16PM +0000, Harald van Dijk wrote: > On 04/01/2019 13:20, Peter Wu wrote: > > Hi, > > > > Dash 'read' builtin with the '-r' option is not POSIX-compliant: > > > > $ printf 'omg\\bar\\x41-\\\\-\n' > input > > $ dash -c 'read -r x < input; cat input; echo "$x"' > > omg\bar\x41-\\- > > omar\x41-\- > > > > The outputs are expected to be equal (which is the case with bash). > > Originally found in dash 0.5.8-2.10 (Ubuntu 18.04), but also reproduced > > with dash 0.5.10.2-1 (Arch Linux). > > This isn't read giving the backslashes special treatment, it's echo. Use > printf "%s\n" "$x" instead and you will get the same output. Sure enough, that was the problem. Sorry for the noise and thank you for pointing it out! Kind regards, Peter