Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jan 2005 18:43:32 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Tom Vilot <tom@vilot.com>
Cc:        questions@freebsd.org
Subject:   Re: my lame attempt at a shell script...
Message-ID:  <20050107164332.GB2249@orion.daedalusnetworks.priv>
In-Reply-To: <41DEBA93.8060909@vilot.com>
References:  <41DEBA93.8060909@vilot.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-01-07 09:36, Tom Vilot <tom@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050107164332.GB2249>