I need to execute a perl script from a shell script. If the execution is success, then I need to ftp a file. Else I want the script to be forced to exit with a non-zero status string. My problem is not the executing of the perl script from shell script, but the things to be done after its execution (if-then-else). I have written the following code.
#!/usr/bin/sh
cd dir_where_perl_pgm_exists
perl my_perl_pgm.pl
ret=$?
if [ $ret -eq 0 ]
then
echo "Success"
echo "FTP the report now"
ftp -n << EOF
open ftp_server
user user_name password
put some_file
ls -l
bye
EOF
else
echo "Failure"
echo "Exit the pgm"
return $ret
fi