[Discuss] Scripting languages (was Re: rsync v. cp in data migration)
Richard Pieri
richard.pieri at gmail.com
Mon May 27 14:32:29 EDT 2013
Derek Martin wrote:
> If you want to use escape sequences portably in your echo commands,
> then you end up having to write silly code like this:
The way I do it is something like a little include that sets $ECHO to be
the relevant command:
case $OS in
$SYSV) echo="/bin/echo -e";;
$BSD) echo="echo";;
$LSB) echo="/usr/bin/echo";;
esac
I source this from scripts that need to echo output and then write my
scripts to use $ECHO instead of echo:
$ECHO "here is a line with a newline\n"
Tricks like that were necessary when wrangling some 20 different UNIXes.
--
Rich P.
More information about the Discuss
mailing list