shell 遍历环境变量
for i in `env`
do
echo "$i"
done
遍历环境变量,并将key和value解析出来,即将变量名称和变量值解析出来:
for i in `env`
do
key=`echo $i | awk -F"=" '{print $1}'`
val=`echo $i | awk -F"=" '{print $2}'`
echo $key"-----"$val
done
shell 遍历环境变量
for i in `env`
do
echo "$i"
done
遍历环境变量,并将key和value解析出来,即将变量名称和变量值解析出来:
for i in `env`
do
key=`echo $i | awk -F"=" '{print $1}'`
val=`echo $i | awk -F"=" '{print $2}'`
echo $key"-----"$val
done