리눅스 export


개요

리눅스 export

실습 1

root@zetawiki:~# VAL=10
root@zetawiki:~# sh -c 'echo VAL=$VAL'
VAL=
root@zetawiki:~# export VAL=20
root@zetawiki:~# sh -c 'echo VAL=$VAL'
VAL=20

실습 2

root@zetawiki:~# cat print_a.sh 
echo A=[$A]
root@zetawiki:~# cat hello.sh 
A=hello
sh print_a.sh
root@zetawiki:~# sh hello.sh 
A=[]
root@zetawiki:~# cat world.sh 
export A=world
sh print_a.sh
root@zetawiki:~# sh world.sh 
A=[world]

같이 보기

참고