[root@localhost ~]# cat s2.sh #!/bin/bash color_name="red" red=31 color=`eval echo '$'"${color_name}"` echo ${color} [root@localhost ~]# sh s2.sh 31 [root@localhost ~]#
[root@localhost ~]# cat s2.sh #!/bin/bash color_name="red" red=31 color=`eval echo '$'"${color_name}"` echo ${color} [root@localhost ~]# sh s2.sh 31 [root@localhost ~]#