http://qs321.pair.com?node_id=621667


in reply to Re^3: [Good news] here docs portability!
in thread [Good news] here docs portability!

No, you are correct; the shell's `` will prefer the builtin echo, so what I gave won't work under some shells without explicitly asking for the coreutils /bin/echo. (Wow, the POSIX standard for echo is really dumb.)
  • Comment on Re^4: [Good news] here docs portability!

Replies are listed 'Best First'.
Re^5: [Good news] here docs portability!
by gaal (Parson) on Jun 17, 2007 at 07:39 UTC
    As much as I like being right by accident, don't even old Bourne shells honor -e? In my original comment, I was thinking of c shells, which do not.

    But instead of relying on the system's /bin/echo, which who knows, might be broken in rusty old systems, why not use Perl for this command (since we know the user has it...)

      Broken? Per POSIX, -e is not a special flag, and should be output. With the XSI extensions, you are supposed to get \r -> CR whether you want it or not. Without XSI, the output when there are backslashes is undefined.

      So perl is the way to go.