I have the following unix shell script, in which i have two integer variables namely a and b.
If a is greater then or equal to b then shell script should exit with returning 0.
Else it should exit with returning 1.
My try:
Script: ConditionTest.sh
#!/bin/sh
a=10
b=20
if [ $a -ge $b ]
then
exit 0
else
exit 1
fi
....
....
....
Running Script:
$ ./ConditionTest.sh
$
Note: I am not getting any return value after executing the file.
$?. Doecho $?after running the script. If you want to see the value as part of the script output then print it:echo 0; exit 0andecho 1; exit 1.