concatenate string in shell script

Stuart Jansen sjansen at buscaluz.org
Thu Mar 16 12:28:34 MST 2006


On Thu, 2006-03-16 at 12:23 -0700, Bryan Sant wrote:
> On 3/16/06, Stuart Jansen <sjansen at buscaluz.org> wrote:
> > #!/bin/sh
> > file="/mnt/windows/My Documents/notes.txt"
> > tensai="Corey"
> > mesg="The world would be a better place"
> > mesg="${mesg} if everyone listened to ${tensai}'s advice."
> > echo "$mesg" >> "$file"
> > mesg="${mesg/a better/an even better}"
> > echo "${mesg/Corey/Stuart}" >> "$file"
> 
> Sweet.  Will this work with the Bourne shell?  Or does this only work
> because sh is a link to bash?

Oops. Forgot to change the shebang after I added those last two lines.
I'm pretty sure that substitution in variables in a bash-ism.

-- 
Stuart Jansen              e-mail/jabber: sjansen at buscaluz.org
                           google talk:   stuart.jansen at gmail.com
:0                         # copy & paste for your convenience
* ^From:.*sjansen@
/dev/null                  # /ignore sjansen!*@*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : http://plug.org/pipermail/plug/attachments/20060316/7da7c36d/attachment.bin 


More information about the PLUG mailing list