The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
SFTP Failed---Request for subsystem 'sftp' failed on channel 0 mahiban AIX 0 07-25-2008 02:51 AM
Amend the size of a Partition Error drchris SUN Solaris 2 02-25-2008 06:58 AM
help in SFTP please help bsandeep_80 Shell Programming and Scripting 3 08-01-2007 02:33 PM
sftp vs scp Sowser UNIX for Advanced & Expert Users 2 03-21-2007 09:33 AM
Script to backup multiple files and amend their filenames m223464 Shell Programming and Scripting 5 11-25-2005 06:30 AM

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 02-15-2009
new2ss new2ss is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 133
amend ftp to sftp

Hi all, below is my current script
Code:
ftp -n << FTPCTRL
 open $my_ip
 user $my_user $my_pass
 ascii
 prompt off
 lcd $myDIR
 cd $ftp_cd
 $OPS $myfile
FTPCTRL
I'd like to amend it to sftp mode. Please advise the correct step.I consulted the man pages of sftp and I suppose I should be using the sftp -b option.
Code:
 sftp -b $batchfile $my_user@remotehost << FTPCTRL .. ..
what should I be storing in my batch file? I'd like to retain my use of the variables $my_user and $my_pass,$myDIR,$ftp_cd,$OPS(get or put),$my_file because they are passed in from another script
  #2 (permalink)  
Old 02-16-2009
frank_rizzo frank_rizzo is offline Forum Advisor  
Resident BOFH
  
 

Join Date: Dec 2007
Posts: 427
put all of your commands in the batch file. do not use the HERE document. you can exclude the open/user commands also. sftp is already using this on the command line. You will be prompted for the password. If this is a problem then I would suggest that you setup a ssh key. this is the best way for an automated script.

If you want to use a variable in the batch file then I would suggest generating the batch file and then call it with sftp
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 07:31 AM.


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