script has been executed successfully or not??

Guys,

How can we know whether a script has been executed successfully or not ?
We dont have any log directories, and we are not given a chance to modify the script. Could someone help me out with this Thanks

echo $?

If this script is a "right" script it should return 0 with success and non-zero value with failure. (You can see return value - exit status - in $? variable, but you should check it immediately after executing script).

1 Like

A shell script could have many unix commands.

Each command has its own return code stored in the variable "$?".

Whoever is writing the script should make use of the "$?" return code variable after
a questionable unix command execution and display the appropriate error message.