concatenate string in shell script
Corey Edwards
tensai at zmonkey.org
Thu Mar 16 09:05:55 MST 2006
On Thu, 2006-03-16 at 09:00 -0700, Wade Preston Shearer wrote:
> Is it possible to do the following (example written in PHP) in a
> shell script?
>
> $var = 'abc';
> $var .= 'dfg';
> $var .= 'hij';
var='abc'
var="${var}dfg"
var="${var}""hij"
var2="klm"
var="${var}${var2}"
I recommend always putting variables in {} and "". {} prevents your
variables from being confused with string literals. "" prevents spaces
from causing problems.
Corey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://plug.org/pipermail/plug/attachments/20060316/a3835a76/attachment.bin
More information about the PLUG
mailing list