How to get the exit satus of a command which I executed in sftp prompt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to get the exit satus of a command which I executed in sftp prompt
# 1  
Old 04-09-2008
How to get the exit satus of a command which I executed in sftp prompt

Hi All,

I need the exit status of a command which is executed through sftp connection.

Example:

sftp user@host <<EOF
mkdir /home/karteek/testing
put /home/xyz.txt /home/karteek/testing
EOF
------
In the above example, I need the exit status of the put command.

Please help me.

The reason for using sftp is that, I need to crate the directories in remote machine.

Thanks,
Karteek
# 2  
Old 04-09-2008
The easy way will be to take status of whole process

Quote:
sftp user@host <<EOF &&
mkdir /home/karteek/testing &&
put /home/xyz.txt /home/karteek/testing &&
EOF
status=$?
# 3  
Old 04-09-2008
Additionally, you could always put the output to a text file and after you come out of the sftp process, check the output file for what ever criteria you wish to confirm all has gone well.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux/bash Script only working if executed from shell prompt

Hi, maybe I'm asking a VERY dumb question, but would anybody out there tell me, why this f****** script won't work if executed as a cronjob, but works fine if executed from a shell prompt? #! /bin/bash set PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin date >>... (3 Replies)
Discussion started by: beislhur
3 Replies

2. Shell Programming and Scripting

Check/get the exit status of a remote command executed on remote host through script

Geeks, Could you please help me out in my script and identify the missing piece. I need to check/get the exit status of a remote command executed on remote host through script and send out an email when process/processes is/are not running on any/all server(s). Here's the complete... (5 Replies)
Discussion started by: lovesaikrishna
5 Replies

3. Shell Programming and Scripting

Sftp hanging at exit

Hi All I was trying to execute below sftp command. echo "cd /${CUST_ID}/inbound/${SAFET_ID}" > $BATCHFILE echo "put ${SOURCE_FILE} ${FILE_NAME}" >> $BATCHFILE echo "exit" >> $BATCHFILE cmd="sftp -o port=2022 -b $BATCHFILE user@$SERVER" $cmd >> $LOGFILE 2>&1 if 2>>$LOGFILE then... (3 Replies)
Discussion started by: Girish19
3 Replies

4. Solaris

Zone console login prompt exit

Hi , I am not able to exit fom zone console login prompt. I have tried options like ~. ~~. and @. but it is not working fo me. Could someone Please help me on this. Thanks in Advance!! Regards, Laxxi (7 Replies)
Discussion started by: Laxxi
7 Replies

5. Shell Programming and Scripting

How to exit prompt when starting a weblogic administration server remotely?

Hi, I am trying to start Weblogic Admin server using start-up script (./startWeblogic.sh) from a remote host using a different user. The server starts fine but prompt is stuck, it does not return Background: We have multiple admin servers in different environment and the requirement is all... (4 Replies)
Discussion started by: bhaskar_m
4 Replies

6. UNIX for Dummies Questions & Answers

Auto-exit from telnet prompt

Hi, Hope all your are doing well. Need a suggestion from you. I am writing an automated shell script that will effectively check the telnet connectivity with different backends from present deployment server. Ideally, this script reads each backend hostname from a configuration file and fires... (4 Replies)
Discussion started by: bhaskar_m
4 Replies

7. Shell Programming and Scripting

Exit from Shell Prompt after Pbrun

I have a ksh script, which pbruns into another account. I want to pbrun run into that account, and continue running all the engine commands(i.e setroot, setsite xxx, etc) in my script. But instead, it pbruns into the account, and just gives me a shell prompt.. and stops there. Only once i... (2 Replies)
Discussion started by: alamurus
2 Replies

8. Shell Programming and Scripting

How can I bypass the Prompt in SFTP

I am on a sun solaris server and trying to create a script that will test if SFTP is up and running on a remote server (which could be unix or windows). My thought was to simply invoke sftp and if I get the prompt ofr "Password" then that is an indication that the service is running and I am... (2 Replies)
Discussion started by: pierluigi22
2 Replies

9. Shell Programming and Scripting

returning un executed string to shell prompt

Hi all, i'm pritty new to chell scripting I'm trying to find a way to return a value to shell without it executing. is there a special character that will encase a sting including the command to a shell without executing, so waiting for the user to press enter. say i wanted to return a value... (3 Replies)
Discussion started by: jvan
3 Replies

10. UNIX for Dummies Questions & Answers

how to find the exit status for the last executed command

I am executing a find command in my script i.e find $2 -type f -name '*.gif' -mtime +$1 -exec rm {} \; how do i check that this command is executed properly.. i would lke t trap the errror and display my error message kinly help.. this is an urgent issue. (1 Reply)
Discussion started by: vijay.amirthraj
1 Replies
Login or Register to Ask a Question