Shell脚本1.sh是这样的
#/bin/bash
if some java command;
then
exit 1;
else
exit 0;
fi
Shell 脚本 2.sh 将根据 1.sh 的结果(1 或 0)确定其执行
#/bin/bash
readyToDoSomethingIfOne=$(1.sh)
if($readyToDoSomethingIfOne=="1");
then
echo "ready to go";
else
echo "Not ready yet" ;
fi
看起来 1.sh 的退出命令没有将值传递给 2.sh。有什么好的方法吗?
顺便说一下,1.sh 和 2.sh 出于业务原因必须分开。
谢谢
最佳答案
#/bin/bash
if 1.sh; then
echo "ready to go";
else
echo "Not ready yet" ;
fi
关于linux - 如何根据第一个脚本的结果从另一个 shell 脚本调用 shell 脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22567314/