Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jan 2005 23:39:39 -0500
From:      Timothy Luoma <lists@tntluoma.com>
To:        Eric F Crist <ecrist@secure-computing.net>
Cc:        FreeBSD-Questions Questions <freebsd-questions@freebsd.org>
Subject:   Re: my lame attempt at a shell script...
Message-ID:  <248793A4-6066-11D9-8BE8-000D93AD26C8@tntluoma.com>
In-Reply-To: <41DE096C.3060903@vilot.com>
References:  <06DDB71C-5DB4-11D9-B56F-000D9333E43C@secure-computing.net> <8B357427-5DB7-11D9-89A5-000D93AD26C8@tntluoma.com> <Pine.NEB.4.61.9.0501041028340.407@kenmore.kozy-kabin.nl> <7B531D49-6041-11D9-8A15-000D9333E43C@secure-computing.net> <41DDE5C5.2050402@vilot.com> <1F964093-6051-11D9-90DC-000D9333E43C@secure-computing.net> <41DE096C.3060903@vilot.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jan 6, 2005, at 11:00 PM, Tom Vilot wrote:

> Eric F Crist wrote:
>
>> What is the point of the { } around some variables?
>
> It's not strictly necessary, except in some cases. i.e:
>
> m=34
> echo $m
> You don't need it there.
> But you would want it here:
> f=/var/filename
> fname=${f//name/name2}
>
> It's when you need to differentiate the variable name from operations 
> around it ... for want of a better explanation

a good explanation.  When I'm being particularly fussy about a script, 
I'll use echo "${m}" just in case $m has some unexpected characters in 
it such as a space ! $ * etc which can really screw things up.

TjL



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?248793A4-6066-11D9-8BE8-000D93AD26C8>