How do I suppress echo of an SFTP get command in a bash script?

Viewed 350

I have a bash script that logs into a remote server, pulls a file, then copies it on the local server to a subfolder. I want to run this as a scheduled cron job, so I don't want it printing any output. I managed to suppress the connection output by using the -q flag to the sftp command. But this script still prints:

sftp> get Export/data.xml

How do I go about suppressing this output? Below is my script.

sftp -q user@server.com <<EOF
get Export/data.xml
EOF
cp data.xml ./www/_resources/data
1 Answers

Prefix the command with @ as sftp man says:

Echo of the command may be suppressed by prefixing the command with a ‘@’ character.

@get Export/data.xml
Related