赞
踩
[root@localhost ~]# vartest=123456
[root@localhost ~]# echo $vartest
123456
[root@localhost ~]# echo ${vartest} //在当前shell中起作用
123456
[root@localhost ~]# bash
[root@localhost ~]# echo $vartest //在子shell中不起作用
[root@localhost ~]# exit
exit
[root@localhost ~]# echo ${vartest}
123456
[root@localhost ~]# export back_dir=/home/backup [root@localhost ~]# test_dir=/opt [root@localhost ~]# export test_dir [root@localhost ~]# echo $back_dir /home/backup [root@localhost ~]# echo $test_dir /opt [root@localhost ~]# env XDG_SESSION_ID=8 HOSTNAME=localhost.localdomain SELINUX_ROLE_REQUESTED= HOME=/root back_dir=/home/backup [root@localhost ~]# unset back_dir //取消环境变量 [root@localhost ~]# unset test_dir [root@localhost ~]# echo $test_dir //环境变量已取消 无输出 [root@localhost ~]# echo $back_dir [root@localhost ~]#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。