Vijay Mallesh
asked on
SFTP Get command fails in Shell Script and works fine Manually
I'm trying to get a file using SFTP command in the shell script and it fails with "Cannot download non-regular file:". Below is the piece of code I have written.
sftp -v -F /usr/home/.ssh/sftp.config <user>@<servername> <<EOF2
cd <targetdirectory>
mget $File
bye
EOF2
Also when I try to list the files in the shell script, it gives "Couldn't get handle: Failure" error.
However, If I do the same operation manually(SFTP to get the file), I'm able to get the file successfully without any errors.
Very much confused as why the SFTP command in shell script is not allowing to download the file whereas the same set of commands when manually run works.
Any inputs is greatly appreciated. Thank you so much!!
Thanks,
Vijay
sftp -v -F /usr/home/.ssh/sftp.config <user>@<servername> <<EOF2
cd <targetdirectory>
mget $File
bye
EOF2
Also when I try to list the files in the shell script, it gives "Couldn't get handle: Failure" error.
However, If I do the same operation manually(SFTP to get the file), I'm able to get the file successfully without any errors.
Very much confused as why the SFTP command in shell script is not allowing to download the file whereas the same set of commands when manually run works.
Any inputs is greatly appreciated. Thank you so much!!
Thanks,
Vijay
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.