From: Eric Blake Date: Mon, 26 Apr 2010 15:30:06 +0000 (-0600) Subject: Clarify octal escapes with tr. X-Git-Tag: v2.66~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7902d0d7ff638caf59a42c0aa923b448ce42fea;p=thirdparty%2Fautoconf.git Clarify octal escapes with tr. * doc/autoconf.texi (Limitations of Usual Tools): Carriage return is portable in octal, but not newline. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index d301e6bd..85d2b11a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-04-26 Eric Blake + + Clarify octal escapes with tr. + * doc/autoconf.texi (Limitations of Usual Tools): Carriage return + is portable in octal, but not newline. + 2010-04-22 Joel James Adamson (tiny change) Add a paragraph to FAQ on Debugging configure scripts. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 1ffaeab4..fa6015f6 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -18393,13 +18393,16 @@ However, these problems are no longer of practical concern. @c --------------- @prindex @command{tr} @cindex carriage return, deleting +@cindex newline, deleting @cindex deleting carriage return Not all versions of @command{tr} handle all backslash character escapes. For example, Solaris 10 @command{/usr/ucb/tr} falls over, even though Solaris contains more modern @command{tr} in other locations. -Therefore, it is more portable to use octal escapes, even though this -ties the result to ASCII, when using @command{tr} to delete -newlines or carriage returns. +Using octal escapes is more portable for carriage returns, since +@samp{\015} is the same for both ASCII and EBCDIC, and since use of +literal carriage returns in scripts causes a number of other problems. +But for other characters, like newline, using octal escapes ties the +operation to ASCII, so it is better to use literal characters. @example $ @kbd{@{ echo moon; echo light; @} | /usr/ucb/tr -d '\n' ; echo} @@ -18409,6 +18412,9 @@ $ @kbd{@{ echo moon; echo light; @} | /usr/bin/tr -d '\n' ; echo} moonlight $ @kbd{@{ echo moon; echo light; @} | /usr/ucb/tr -d '\012' ; echo} moonlight +$ @kbd{nl='} +@kbd{'; @{ echo moon; echo light; @} | /usr/ucb/tr -d "$nl" ; echo} +moonlight @end example Not all versions of @command{tr} recognize ranges of characters: at