I need to execute a perl script from a shell script. If it is success, I need to do a few more things else on error it should exit the shell script with an error code.
My problem is not with running the perl script or getting the status code but the if-then-else part of the script. No matter what, it goes into the else part and prints "failure". Is the syntax of if-then-else ok?
I am pasting the code below.
#!/usr/bin/sh
cd go_to_dir_where_perl_program_exists
/usr/bin/perl perlscript.pl
echo "Status String is $?"
if( $? -eq 0)
then echo "success"
# do some more stuff
else
echo "failure"
# do some more stuff