Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


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

[Discuss] Scripting languages (was Re: rsync v. cp in data migration)



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.



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org