It is mistaken to assume that there is a consistent `echo' available
in all environments. In my experience `echo' can only be relied upon
for printable characters. To escape other things requires different
invocations depending on which shell, etc., is being used. Even
things like the ksh builtin and /bin/echo behave differently on
different platforms.
For what its worth, this is from a script of mine which needs to use
escapes.
# Look for a version of echo that handles escapes
if [ `echo "a\062z"` = a2z ]
then ECHOE="echo"
elif [ `echo -e "a\062z" 2>&1` = a2z ]
then ECHOE="echo -e"
elif [ `print "a\062z" 2>&1` = a2z ]
then ECHOE="print"
elif [ `/bin/echo -e "a\062z" 2>&1` = a2z ]
then ECHOE="/bin/echo -e"
else ECHOE="/bin/echo"
fi
A more robust method is to use tr to generate control characters, e.g.
% echo 'a^b' | tr '^' '\012'
a
b
--
Pete Forman
Western Geophysical
[EMAIL PROTECTED]
- VC/RCS: Checking in files remotely & change comment... DE WEERD, Mario
- Re: VC/RCS: Checking in files remotely & chang... Kai Gro�johann
- Re: VC/RCS: Checking in files remotely & c... Daniel Pittman
- Re: VC/RCS: Checking in files remotely &am... Kai Gro�johann
- Re: VC/RCS: Checking in files remotely... Francesco Potorti`
- Re: VC/RCS: Checking in files rem... Kai Gro�johann
- Re: VC/RCS: Checking in files... Francesco Potorti`
- Re: VC/RCS: Checking in f... Kai Gro�johann
- Re: VC/RCS: Checking in f... Pete Forman
- Re: VC/RCS: Checking in f... Edward J. Sabol
- Re: VC/RCS: Checking in f... Francesco Potorti`
- Re: VC/RCS: Checking in f... Kai Gro�johann
- Re: VC/RCS: Checking in f... Greg Stark
- Re: VC/RCS: Checking in f... Kai Gro�johann
- Re: VC/RCS: Checking in f... Kai Gro�johann
- Re: VC/RCS: Checking in f... DE WEERD, Mario
- Re: VC/RCS: Checking in f... DE WEERD, Mario
- Re: VC/RCS: Checking in f... Kai Gro�johann
- Re: VC/RCS: Checking in f... DE WEERD, Mario
