sftp automation script not working

Hi all ,

can any one tell me how to code SFTP automation script ?

I searched lots of forums but i didn't get any useful information:(

I don't want auto Login script > like if u run the script it should automatically login into specific account and etc..

Just i want the following things need to be in done in my script.

manual password entry.
after we enter the password , what ever the commands in shell script will have to execute .

I wrote the code like this >

sftp username@xyz.com
pwd
cd /xyz
get abc.ksh

But after login the command's are not executed , just simply i got prompt for manual entry :frowning:

can any one please advise me on this :slight_smile:

Almost exactly same issue is raised in this thread: sftp automation script not working

I think you can just join the thread - better than two separate threads on same issue, right ? :slight_smile:

Right :slight_smile: thanks for the quick reply

Try this...

#!/bin/bash
sftp username@xyz.com <<EOF
pwd
cd /xyz
get abc.ksh
EOF

--ahamed

Thanks --ahamed . let me try this code once :

---------- Post updated at 11:30 AM ---------- Previous update was at 10:57 AM ----------

@ahamed
could please advise how to exit from sftp ? commands are executing but sftp connection is not closing after those commands are executed .