my lame attempt at a shell script...

Timothy Luoma lists at tntluoma.com
Thu Jan 6 20:39:41 PST 2005


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



More information about the freebsd-questions mailing list