095-shell中的父進程和子進程

source /data/test.env 
echo $USER 
carlton 
bash 
# 進入子shell 
echo $USER 

運行bash以後變量爲空shell

$  set -a  
$  source /data/test.env
$  set +a # 關閉開關,防止以後的定義不當心被export 
$  bash 
$  echo $USER 
carlton

仔細看變化,發現依然能夠打印變量bash

相關文章
相關標籤/搜索