Hi.
Quote:
name
A word consisting solely of letters, numbers, and underscores, and beginning with a letter or underscore. Names are used as shell variable and function names. Also referred to as an identifier.
-- excerpt from Bash Reference Manual
|
Note that the $ is not listed.
There is a way that the look of your requirement can be done -- essentially as an indirect assignment:
Code:
#!/bin/bash -
# @(#) z1 Demonstrate indirect assignment.
echo
a=0
b=1
a=b
echo " first assignment a = $a, b = $b"
echo
$a=2
echo " second assignment a = $a, b = $b"
echo
eval $a=2
echo " eval assignment a = $a, b = $b"
exit
Producing:
Code:
% ./z1
first assignment a = b, b = 1
./z1: line 12: b=2: command not found
second assignment a = b, b = 1
eval assignment a = b, b = 2
However, in general, $ is used as the dereferencing operator in shells. In elementary
perl, it
must be used to identify scalar variables ... cheers, drl