What will be the return status in the following sheel script.

Posted by Pradip Bhojania on Stack Overflow See other posts from Stack Overflow or by Pradip Bhojania
Published on 2010-04-16T12:40:01Z Indexed on 2010/04/16 12:43 UTC
Read the original article Hit count: 152

Filed under:

i have two shell scripts:

script1.sh

echo "date : DATE" exit 0;

script2.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?

© Stack Overflow or respective owner

Related posts about shell-scripting