Suvasis
Suvasis

Reputation: 1481

"sftp: command not found" running sftp from Unix Shell Script

I can transfer a file from one server to another using sftp in the prompt.

I try using sftp in a shell script and I get the following error:

"sftp: command not found" 

I tried the below code from a script:

sftp ${USER}@${HOST} <<EOF
quote pass ${PASSWD}
cd  ${PATH}
mput *.csv
EOF

Can anyone help me with this?

Upvotes: 1

Views: 16268

Answers (1)

Geek Num 88
Geek Num 88

Reputation: 5312

use an absolute file location instead of depending on the path - for instance the sftp binary is probably located in /usr/bin/ so instead of just using sftp - try to use /usr/bin/sftp

To find out where the binary is located use the which command

which sftp

Upvotes: 3

Related Questions