[clue] shell scripting Q
marcus hall
marcus at tuells.org
Mon Feb 11 17:00:57 MST 2013
On Mon, Feb 11, 2013 at 03:27:08PM -0700, Dan Kulinski wrote:
> When you use single quotes you stop variable expansion. Try double quotes
> or forcing expansion with scale='2;${total}/60'
>
> Dan
Double quotes is definately the answer.. But, I don't understand what
you're trying to say about "forcing expansion".
Try the following:
xxx=test
echo $xxx
echo "$xxx"
echo '$xxx'
echo ${xxx}
echo "${xxx}"
echo '${xxx}'
I think you will find that the single quotes never perform variable
substitutuion. Where the curly braces are useful are when the variable
is immediately followed by a character that could be part of a variable
name. For example:
echo $xxx_yyy
echo ${xxx}_yyy
The first case tries to expand the variable xxx_yyy, while the second case
expands the variable xxx and follows that expansion with "_yyy". Sometimes
it is very important, but usually it is not needed.
marcus hall
marcus at tuells.org
More information about the clue
mailing list