我的问题是自我描述的:
script1.sh 包含:
#!/bin/sh
export SOMEVAR=0
echo "1, SOMEVAR=$SOMEVAR"
./script2.sh
echo "2, SOMEVAR=$SOMEVAR"
script2.sh 包含:
#!/bin/sh
SOMEVAR=1
./script1.sh 给出:
1, SOMEVAR=0
2, SOMEVAR=0
虽然我想:
1, SOMEVAR=0
2, SOMEVAR=1
我怎样才能获得想要的结果?