"Bash 자식스크립트에서 변수 받아와서 다른 자식스크립트에 변수 전달하기"의 두 판 사이의 차이

(새 문서: ==개요== {{소스헤더|parent.sh}} <source lang='bash'> #!/bin/bash source child1.sh export foo export bar ./child2.sh </source> {{소스헤더|child1.sh}} <source lang='bash'> #!/...)
(차이 없음)

2018년 11월 15일 (목) 01:21 판

개요

parent.sh
#!/bin/bash
source child1.sh
export foo
export bar
./child2.sh
child1.sh
#!/bin/bash
foo=hello
bar=world
echo -- child1 end...
child2.sh
#!/bin/bash
echo -- child2 start...
echo foo=[$foo]
echo bar=[$bar]
실행결과
$ ./parent.sh 
-- child1 end...
-- child2 start...
foo=[hello]
bar=[world]
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}