개요
- 리눅스 set -a
- 생성 또는 변경되는 변수를 export되게 함
parent.sh
#!/bin/bash
set -a
syntaxhighlight child1.sh
./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]