Date: Sun, 15 Nov 1998 12:35:20 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Ian Chapman cc: "'djgpp AT delorie DOT com'" Subject: Re: Bash and sed In-Reply-To: <915C65C50371D11187AD0000F881B9A401858D2A@bcarua62.ca.nortel.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Thu, 12 Nov 1998, Ian Chapman wrote: > The line ... A="`echo | tr '\012' '\001'`" ... is to ensure > portability. However what we have gives "unknown option to s". ``Portability'' my foot ;-). This `tr' trick assumes that the empty line produced by `echo' holds a single Newline character (octal code 012). But on DOS and Windows, `echo' outputs the CR-LF pair (\015\012) instead. So after `tr' has done its thing, A gets a string "\015\001", not a single character 001 as the script expects. Here's a portable way to do this (should work on Unix as well): A="`echo | tr -s '\015\012' '\001\001'`" The `-s' magic is described in the Textutils manual.