Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 158

Shell script with EXPECT and PUT to SFTP server

$
0
0

I'm working on a shell script and I'm trying to send a backup file to a sftp server :

remotepath=/backup/expect -c "spawn sftp user@172.11.23.4expect "password:"send "password123\r"expect "sftp>"send "put /back_up/bkp_2022.tar.gz $remotepath\r"expect "sftp>"send "bye\r""

And this is the output that I get without the file being transfer - It just creates "?send put" and "?send byer?".

-rw-r-----. 1 admin admin 1267 Aug 17 11:14 script.sh-rw-r-----. 1 admin admin    0 Aug 17 11:15 ?send put-rw-r-----. 1 admin admin  167 Aug 17 11:15 ?send byer?

Can you please help ?


Viewing all articles
Browse latest Browse all 158

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>