The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
exit codes from rexec? diego_sapphire UNIX for Dummies Questions & Answers 4 05-04-2009 12:44 PM
Exit Codes cmschube Shell Programming and Scripting 1 04-04-2008 12:34 PM
difference b/t the exit codes $* and $@ praveen_b744 Shell Programming and Scripting 1 09-19-2007 10:53 AM
Where can I find a list of exit codes? (Exit code 64) jkuchar747 UNIX for Dummies Questions & Answers 3 12-07-2004 06:08 PM
exit codes donna carter High Level Programming 3 05-31-2001 10:35 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-31-2007
vikramsnest vikramsnest is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 7
Question Exit codes in SFTP

HI All,
I have created a unix script which takes 2 parameters and using sftp tranfers files to remote location
following is the script

#!/bin/ksh
#
#
# Parameter 1 is the complete path of the destination server
# Parameter 2 is the complete path of the file which is to be FTP
#-----------------------------------------------------------------
DEST_SERV=host@xxx.xxsftp.xx.com
FTP_STR=`sftp $DEST_SERV << EOF
echo $?
cd $1
echo $?
put $2
echo $?
quit
EOF`
echo --- $FTP_STR

i need to know the exit codes after each command is executed so tht i can trap it.
My problem is tht even if the put filename or directory path is invalid the exit code is returned as "0".
Can you pls help me.

Thanks a lot
Vikram.
****************

Last edited by vikramsnest; 08-01-2007 at 08:05 PM..
  #2 (permalink)  
Old 08-16-2007
sumitpandya sumitpandya is offline
Registered User
  
 

Join Date: Mar 2006
Location: Ahmedabad
Posts: 125
Vikram,
What you wanted to do with "FTP_STR" ? If you really looking that way as an option to get exit status then remove that back-quotes and run the sftp block as it is. After the block i.e. EOF, you can get exit-status by traditional $?
In your code you always getting "0" because that status seems of FTP_STR assignment (=)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0