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 and function 1

Status
Not open for further replies.

nimrodman

MIS
Nov 22, 2005
43
US
I have a working script which I have written, but I want to make an adjustment to call a function after invoking sftp, it is something like this

sftp user$node
prompt
lcd $LOCAL_DIR
do_this # that is the function
bye
sftp eof

it is ot calling the function, any ideas?
 
More likely it is like this:

[tt]sftp user@node <<sftp_eof
prompt
lcd $LOCAL_DIR
do_this # that is the function
bye
sftp_eof

do_this[/tt] is read by sftp, not by the shell...

If the actions you want can be put in a shell script, you can call it from within the sftp session like this:

[tt]sftp user@node <<sftp_eof
prompt
lcd $LOCAL_DIR
!/path/to/do_this # run a shell script
bye
sftp_eof[/tt]


or else, if you really want to call a function, like this:

[tt]sftp user@node <<sftp_eof
prompt
lcd $LOCAL_DIR
bye
sftp_eof
do_this # run a shell function[/tt]


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top