>>> Например, выведи мне строку "-n".
>>> echo -e '\b-n'
>> А если переносимо, чтоб и на bash и на dash?
> [ $SHELL == "dash" ] then
> [ $SHELL == "bash" ] then
> [ $SHELL == "mash" ] then
> [ $SHELL == "sash" ] then Кажется, вы предлагали echo для компактности. Все, гуляй компактность.
>> Например, dash выдаст: -e-n
> On XSI-conformant systems, if the first operand is -n, it shall be
> treated as a string,
> not an option. The following character sequences shall be recognized on XSI-conformant
> systems within any of the arguments:
Прямо перед этим:
> If the first operand is -n, or if any of the operands contain a <backslash> character, the results are implementation-defined.
===============
> Так что, это ты пишешь не по стандарту, а не echo плохое.
> :D
printf един, а у echo
>APPLICATION USAGE
> It is not possible to use echo portably across all POSIX systems unless both -n (as the first argument) and escape sequences are omitted.
> The printf utility can be used portably to emulate any of the traditional behaviors of the echo utility as follows (assuming that IFS has its standard value or is unset):
================
>> В стандарте на posix shell вообще нет echo.
> The Open Group Base Specifications Issue 7, 2018 edition
> IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)
> Copyright © 2001-2018 IEEE and The Open Group
> https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/
Ну тогда уж сюда, а то еще раздел "Command language" искать.
https://pubs.opengroup.org/onlinepubs/9699919799.2018edition...
И то - сам стандарт прямо говорит, что переносимость у echo так себе. Вот делать нечего, как зачитывать все эти имена вместо одной строчки printf. Не та цель.