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

Re: RH9 breaks bash ?



In regard to: Re: RH9 breaks bash ?, Scott S. Ross said (at 5:52pm on Dec...:

>I looked into this and it seems that echo has this problem a lot. Some
>versions use escape characters, others do not. Posix.2 chimes in further
>restricts what echo can do (by default).
>   http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html
>Posix defines the escape character handling as implementation defined.
>But, in the same paragraph, defines them as supported on XSI-conformant
>systems (thus the xpg option flag in bash).

POSIX and XPG are related, but they're not the same thing.  It's been
a while since I've looked at the relevant specs, but you probably want
to be looking in the "XSH" section of the XPG (X/Open Portability Guide)
specifications.  I believe XSH 5.0 (or perhaps XCU, if there is one --
this is all from memory) is what corresponds to the UNIX98
specification.  That would likely be the most relevant spec for what
the shell and/or the external echo command should do regarding escape
sequences.

>In the informative section of the spec, they suggest using printf(1)
>instead of echo for portable behavior.

Do relics like SunOS 4.1.3 have a printf binary?  I don't believe it was
built in to the /bin/sh or /5bin/sh.  Every UNIX I've ever seen has an
`echo' (either builtin or external to the shell), but I don't believe they
all have `printf'.  Not a concern if you only need to deal with modern
systems.

Tim
-- 
Tim Mooney                              mooney@dogbert.cc.ndsu.NoDak.edu
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164




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