I have another shell script question. I am trying to pass a script a string, replace a portion with something else, and then return the updated string.

Never mind. I got it:

newString=$(echo $@ | sed 's/searchFor/replaceWith/')
echo $newString


I am curious how I would make searchFor and replaceWith variables.

This…

searchFor="search_for_text"
replaceWith="replace_with_text"
newString=$(echo $@ | sed 's/$searchFor/$replaceWith/')
echo $newString


…didn't work.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

/*
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