shell 里面的环境变量

2018-07-10  本文已影响8人  shuff1e
[root@shuffle-dev ~]$ res="success"
[root@shuffle-dev ~]$ export | grep res
[root@shuffle-dev ~]$ export res
[root@shuffle-dev ~]$ export | grep res
declare -x res="success"
[root@shuffle-dev ~]$ res="failed"
[root@shuffle-dev ~]$ export | grep res
declare -x res="failed"
[root@shuffle-dev ~]$ var="hello"
[root@shuffle-dev ~]$ cat test.sh 
#!/bin/bash
echo $res
echo $var
[root@shuffle-dev ~]$ bash test.sh 
failed

[root@shuffle-dev ~]$ 
上一篇下一篇

猜你喜欢

热点阅读