[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: echo



On 2013-12-01, Eugene Berdnikov wrote:

>  В мане действительно написано как это можно сделать иначе, правда,
>  нужно понимать, что команды echo бывают разные (/bin/echo и встроенные
>  в шелл, т.е. built-in, и у них флаги по умолчанию бывают разные).
>  Чтобы понять разницу, нужно почитать ещё ман на использумый шелл,
>  потому что "man echo" рассказывает про /bin/echo.

Еще стоит почитать POSIX...

  http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html

  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):

          The historic System V echo and the requirements on XSI
          implementations in this volume of POSIX.1-2008 are equivalent to:

          printf "%b\n" "$*"

  New applications are encouraged to use printf instead of echo.

И перестать использовать echo ))

-- 
Best regards!


Reply to: