On Thu, 2007-05-17 at 12:20 -0600, Alec Shaw wrote:
> In bash try:
> newParam = ${oldParam//dick/harry}

Unless you need the full power of sed, this is the best solution. I'd
only make a minor tweak:

newParam="${oldParam//dick/harry}"

Stuarts rule of shell variables: Always put shell variables in double
quotes unless you have a good reason not to.

newParam="$(echo $oldParam | sed -r 's/dick/harry/g')"

is fine as long as you remember the /g. I also like to add a -r and put
thing in single quotes to keep it more readable.

My one concern is exceeding the maximum command length, at a certain
point you need to use a real programming language.

-- 
Stuart Jansen              e-mail/jabber: [EMAIL PROTECTED]
                           google talk:   [EMAIL PROTECTED]

"However beautiful the strategy, you should occasionally look at 
the results." -- Winston Churchill

Attachment: signature.asc
Description: This is a digitally signed message part

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to