Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SFTP from within a shell script

Status
Not open for further replies.

Geek8

Programmer
Apr 23, 2003
31
US
Hi,
I am trying to figure out how I can successfully SFTP a file from within a shell script. Currently we do a few things with FTP within a shell script, but we are in the process of changing this. Can someone point me to a good way that I might be able to do the same thing with SFTP? Honestly I don't know where to begin. I just thought changing my FTP script would work, but it didn't. I am including my FTP script for starters, and if anyone has any advice or tips I would really appreciate it.

Script:

ftp -n << EOF
verbose
open xxxx.xxxx.xxxx.xxxx
user userid passwd
binary
cd ..
get $var1 $var2
close
EOF

*the var1 and 2 values are set in the script. The whole chunk is embedded within a larger script.

Thanks so much,

Geek.
 
Have you tried something like this ?
Code:
sftp user@host:$var1 $var2

Hope This Help
PH.
 
Thanks, I might try both methods out and see where I get.

I will keep you updated.

Thanks again,

GEEK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top