concatenate string in shell script

Stuart Jansen sjansen at
Thu Mar 16 09:58:37 MST 2006

On Thu, 2006-03-16 at 09:05 -0700, Corey Edwards wrote:
> I recommend always putting variables in {} and "". {} prevents your
> variables from being confused with string literals. "" prevents spaces
> from causing problems.

file="/mnt/windows/My Documents/notes.txt"
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"

Stuart Jansen              e-mail/jabber: sjansen at
                           google talk:   stuart.jansen at
: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 : 

More information about the PLUG mailing list