On Wed, Mar 14, 2012 at 10:27:52PM +0100, David Kastrup wrote:
> And the MacOSX /bin/sh is the first shell I heard of that does not grok
> echo -n.

...
>      If this may not be true, `printf' is in general safer and easier
>      to use than `echo' and `echo -n'.

This matches the open group specifications.

http://pubs.opengroup.org/onlinepubs/009695399/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 IEEE Std 1003.1-2001 are
equivalent to:

        printf "%b\n" "$*"

        The BSD echo is equivalent to:

        if [ "X$1" = "X-n" ]
        then
            shift
            printf "%s" "$*"
        else
            printf "%s\n" "$*"
        fi

    New applications are encouraged to use printf instead of echo.



- Graham

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to