Visit Our UNIX and Linux User Community

To execute next UNIX command after ending SFTP process.

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To execute next UNIX command after ending SFTP process.
# 1  
Old 03-20-2008
To execute next UNIX command after ending SFTP process.

I am trying to run a simple UNIX command after i successfully executed SFTP command as shown below.
echo 'Step-1'
sftp -vvv -b path
echo 'Step-2'

In above script it executes from the 1st 'echo' command till the 'exit' then comes out of the script. But my requirement is to also execute the 2nd 'echo' command. So is there a way to run further UNIX command after SFTP, even by calling another script to run further command is fine.

Thanks for your help..
# 2  
Old 03-20-2008
Skip the exit. If you are echoing your ftp-style commands, pipe it through to sftp:

echo "put $myfile $hostdest/$hostfile" | sftp $verbosity $hostpass $hostuser@$hostname >>$MYLOG 2>&1

Otherwise, you do much better with scp:

scp $loclfile $hostuser@$hostname:$trgtdir/.

# 3  
Old 03-20-2008
To execute next UNIX command after ending SFTP process.

My problem is not in using SFTP command, but not able to execute any UNIX command after i successfuly completed SFTP. Currently it exits out of script after SFTP command, which i need to use. Is there a way to exit out of SFTP ?
# 4  
Old 03-20-2008
Again, skip the exit ... Pipe the echo through sftp which will effectively exit on its own.

Previous Thread | Next Thread
Test Your Knowledge in Computers #354
Difficulty: Medium
gawk is the only awk implementation that makes serious progress implementing internationalization and localization and TCP/IP networking.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HOW TO Check for process ending?

Hello, I'm new of this forum and have very very old and rusty memories of shell scripting (my latest script dates back to about 20 years ago !). My need is following: I'm testing a software that make a backup, but at now is not implemented the email report (the sw is in beta). I'm trying to... (1 Reply)
Discussion started by: dadep
1 Replies

2. Shell Programming and Scripting

How to execute previous command in UNIX?

Hi, I was able to use !! on the console. But when I used !! in the, it says something like command not found. (3 Replies)
Discussion started by: alvinoo
3 Replies

3. Shell Programming and Scripting

Process to read a new file entry and execute a command

I need to develop a process/daemon which will constantly monitor a file for new entry and execute a command. for eg, there is a file /var/log/inotify.log When a new entry like below gets appeneded to this file, execute the command as follows. /home/user/public_html/bad.php|CREATE ... (2 Replies)
Discussion started by: anil510
2 Replies

4. Shell Programming and Scripting

Using expect command, spawn will not start sftp process

Hi all, I have a script that runs sftp with expect so I can login and send a file in a cronjob. I've installed this on a couple other servers and it has been fine. However, this time on this machine, it seems to be giving me an issue. It won't move past the spawn sftp command and return a... (3 Replies)
Discussion started by: ltyrrell
3 Replies

5. Shell Programming and Scripting

How to execute PMCMD command in Unix?

Hi All, I am trying to run the PMCMD commend to execute the informatica workflow but while executing from my home directory i am getting below error ksh: pmcmd: not found I executed from my server/bin directory too. I am getting the same error. My commend is: pmcmd startworkflow -sv... (3 Replies)
Discussion started by: kannansr621
3 Replies

6. Shell Programming and Scripting

UNIX script abruptly ending due to ssh command

Below UNIX script abruptly ends while reading second line from file. When I comment 'ssh' command the script works as expected. I think I will have to run ssh command in a different process, but haven't got a handle yet as regards to how to do that. Any help in resolving this problem is highly... (1 Reply)
Discussion started by: jeeteshkc
1 Replies

7. Shell Programming and Scripting

Execute a unix command

Hi, Please suggest me to execute unix command. Input : 2011-01-01 00:00:00 Required output : 20110101000000 YYYYMMDDHH24MISS Regards Akshu (4 Replies)
Discussion started by: akshu.agni
4 Replies

8. UNIX for Dummies Questions & Answers

How to execute a command on UNIX?

Hi guys, I'm completely new to UNIX and Linux and all that stuff. I've been using webhosting (shared) for some time years now and recently I've wanted to carry out some tasks that have had some commands which are not familiar to me. One was to install Mailman and the other to copy files from one... (6 Replies)
Discussion started by: BenA
6 Replies

9. Programming

execute unix command from java eclips

Hi all, I tried to execute the command by 2 ways : 1) Java Runtime class exec method - but the problem there is that it only can execute scripts without arguments(I need with args) 2) the Jtux classs Uprocess- the problem it is not supported by windows and my eclips platform is on... (0 Replies)
Discussion started by: katzs500
0 Replies

10. Shell Programming and Scripting

execute command unix with java:possible or not?

hi everybody, i have a small unix script and i want to use it with java, so how can i executte unix command with java (if it is possible): in fact i want to use some values returned by this script with java swings. is it possible (of course everything is possible) but how can i do? thank you in... (4 Replies)
Discussion started by: mips
4 Replies

Featured Tech Videos