If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > executing perl script from shell script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-29-04, 02:18
shilpam shilpam is offline
Registered User
 
Join Date: Mar 2004
Posts: 1
executing perl script from shell script

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
Reply With Quote
  #2 (permalink)  
Old 03-29-04, 04:24
aigles aigles is offline
Registered User
 
Join Date: Jan 2004
Location: Bordeaux, France
Posts: 319
What is your problem ? This script seems to be correct
__________________
Jean-Pierre.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On