Chinaunix
标题:
变量展开
[打印本页]
作者:
fox000002
时间:
2008-12-16 04:52
标题:
变量展开
#!/bin/bash
#
var=1
var2=var
eval "echo \$$(echo $var2)"
VAR1=1
VAR2=2
VAR3=3
VAR4=4
VAR5=5
VAR_LIST="VAR1 VAR2 VAR3 VAR5"
for var in ${VAR_LIST}
do
eval "echo \$$(echo $var)"
echo ${!var}
done
本文来自ChinaUnix博客,如果查看原文请点:
http://blog.chinaunix.net/u1/38053/showart_1722386.html
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2