This is a very basic question I am just quite new to bash and couldn't figure out how to do this. Googling unfortunately didn't get me anywhere.
My goal is to connect with sftp to a server, upload a file, and then disconnect.
I have the following script:
UpdateJar.sh
#!/bin/bash
sftp -oPort=23 kalenpw@184.155.136.254:/home/kalenpw/TestWorld/plugins
#Change directory on server
#cd /home/kalenpw/TestWorld/plugins
#Upload file
put /home/kalenpw/.m2/repository/com/Khalidor/TestPlugin/0.0.1-SNAPSHOT/TestPlugin-0.0.1-SNAPSHOT.jar
exit
the issue is, this script will establish an sftp connection and then do nothing. Once I manually type exit in connection it tries to execute the put command but because the sftp session has been closed it just says put: command not found.
How can I get this to work properly?
Thanks