my lame attempt at a shell script...

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Jan 7 08:43:36 PST 2005


On 2005-01-07 09:36, Tom Vilot <tom at vilot.com> 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}

Or when characters adjacent to the variable name may be difficult to
separate from the name itself:

	disk="ad0"
	slice="${disk}s1"
	partition="${slice}a"
	#
	echo "${disk} ${partition} ${slice}"

- Giorgos



More information about the freebsd-questions mailing list