开发者

What will be the return status in the following shell script

开发者 https://www.devze.com 2022-12-27 16:39 出处:网络
i have two shell scripts: script1.sh echo \"`date` : DATE\" exit 0; scri开发者_Python百科pt2.sh ./scripts1.sh

i have two shell scripts:

script1.sh

echo "`date` : DATE"
exit 0;

scri开发者_Python百科pt2.sh

./scripts1.sh
if [ $? -eq 0 ]; then
    reboot;
else
    echo "Failed"
fi

What should be the result. Ideally it should have been "reboot" , however on some execution i got the "failed" message too. Can anyone explain why this happens?


It looks to me like the second script calls a script named, "scripts1.sh," but the name of the first script is, "script1.sh." In other words, you have an extra "s" in the name of that first script, when you reference it in the second.

0

精彩评论

暂无评论...
验证码 换一张
取 消