hi,
i am having 2 linux boxes as source and 1 linux box as destination.i want to create a shell script containing code to transfer a csv file from either of the 2 linux boxes (file will be present in just one box, i need to check both the boxes to see which box has the csv file) to 3rd linux box using sftp. suppose i am running this script from 3rd linux box, based on searches i have written the following script.
#/bin/sh
sftp username@host1ip
cd remote_host_file_path
mget filename
rm filename
quit
cd home_path
mv filename path_where_file_needs_to_be_copied
sftp username@host2ip
cd remote_host_file_path
mget filename
rm filename
quit
cd home_path
mv filename path_where_file_needs_to_be_copied
when i run this script through command prompt i get an error like this:
cannot find mget or mget not a command
cd not a command
rm not a command
if i give any echo command in this it is printing the echo value.can someone please help me out with this script. i have verified the keys..so it doesnt ask me to enter the password for connecting to remote host. also when i am running all the commands one by one from command prompt the script is working absolutely fine.