shell變量
1、系統變量
[[email protected] ~]# env #查看系統變量
[[email protected] ~]# echo $HOSTNAME #查看變量
passion
[[email protected] ~]# set #系統變量和自定義變量均能輸出
2、自定義變量
[[email protected] ~]# a=1,b=2 #定義變量a
[[email protected] ~]# echo $a $b
1,b=2
[[email protected] ~]# c=3;d=4 #定義變量c和d
[[email protected] ~]# echo $c $d
3 4
[[email protected] ~]# echo $b
[[email protected] ~]# HISTSIZE=2000 #修改history條目數量為2000
[[email protected] ~]# echo $HISTSIZE #查看修改後的變量
2000
[[email protected]
[[email protected] ~]# echo $myvim
/usr/bin/vim
[[email protected] ~]# bash #進入到bash中
[[email protected] ~]# echo $d #查看變量沒有可取值
[[email protected] ~]# exit
exit
[[email protected] ~]# export a=1 #生效變量
[[email protected]