On 07/27/2017 09:44 AM, Bosco wrote: > I don't have any problem, I only show you one case where I had to fix > an script in order to work a compilation in dash. > > I'm using dash because of simplicity, unfortunately I don't understand > how things work. > > I think the problem is of dash, I only want to report that dash fails > at parse scape sequence. > For instance, the command > > echo \\\\ > > prints > > \ Correct, per POSIX. Incorrect, for portable code (since not all echo implementations obey POSIX; many require to type echo -e \\\\ to get single output, but -e is not POSIX). > > I think it should print > \\ Wrong per POSIX, but it matches what you get on bash if you don't turn on 'shopt -s xpg_echo' and 'set -o posix' simultaneously (yes, bash has two separate knobs that BOTH have to be on to get POSIX behavior). > > I don't have to decided how dash should understand things because it > isn't my project. I only advise of a bad behavior, of course from my > point of view. The bad behavior is not in dash, but in your non-portable use of echo with a \ in the argument. Use printf instead, if you want your script to work in more than one shell. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org