views:

24

answers:

1

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?

A: 

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.

Stephen Harmon
Sorry that was a just a typing mistake. The script called is exactly the one present.
Pradip Bhojania