On 09/28/2015 10:48 AM, Mikhail Usenko wrote: > On Mon, 28 Sep 2015 08:56:14 -0600 > Eric Blake <...> wrote: >> >> 'echo -n' and 'echo -e' are non-portable (even in bash; because I can >> use 'shopt -s xpgecho' to get POSIX-mandated behavior). Use 'printf' >> instead. >> > > xpg_echo doesn't change 'echo -ne' behavior
xpg_echo in isolation does not, and POSIXLY_CORRECT in isolation does not, but together they DO affect echo: $ bash -c 'echo -n hi' hi $ bash -c 'shopt -s xpg_echo; echo -n hi' hi $ bash -c 'POSIXLY_CORRECT=1; echo -n hi' hi $ bash -c 'POSIXLY_CORRECT=1; shopt -s xpg_echo; echo -n hi' -n hi -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature