Date: Thu, 12 Dec 2002 16:46:20 +0100 From: Roman Neuhauser <neuhauser@bellavista.cz> To: Paul Murphy <pnmurphy@cogeco.ca> Cc: FreeBSD Questions <freebsd-questions@FreeBSD.ORG> Subject: Re: Shell variables Message-ID: <20021212154620.GH56031@freepuppy.bellavista.cz> In-Reply-To: <20021212075922.13985ff8.pnmurphy@cogeco.ca> References: <20021212075922.13985ff8.pnmurphy@cogeco.ca>
index | next in thread | previous in thread | raw e-mail
please keep the line length below 75 characters. thank you.
# pnmurphy@cogeco.ca / 2002-12-12 07:59:22 -0500:
> I am having trouble understanding what is the difference between
> "$variable" and "${variable}".
if the variable name is really "variable", then none.
> I have read sh(1) and understand than ${} is a "parameter" and can
> contain more than just a variable, but browsing through /etc/rc I see
> lots of "${variable}" (i.e. "case ${svc_val} in").
>
> Is this just for readability or is there some functional difference?
sh(1):
The simplest form for parameter expansion is:
^^^^^^^^^^^^^^^^^^^
${parameter}
The value, if any, of parameter is substituted.
The parameter name or symbol can be enclosed in braces, which are
^^^
optional except for positional parameters with more than one digit
^^^^^^^^
or when parameter is followed by a character that could be
interpreted as part of the name.
so yes, it's mostly a matter of style.
--
If you cc me or remove the list(s) completely I'll most likely ignore
your message. see http://www.eyrie.org./~eagle/faqs/questions.html
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021212154620.GH56031>
