code-8
code-8

Reputation: 58642

Convert multiple SFTP command lines to a single line command line

How do I convert this EOF into a one line sftp command-line?

sftp -v [email protected] <<EOF
    mkdir /home/forge/web-app/public/backup/$HOSTNAME/$DATE
    put $path/* /home/forge/web-app/public/backup/$HOSTNAME/$DATE
    bye
EOF

Upvotes: 1

Views: 3135

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202177

Your question has nothing to do with SFTP/sftp. It's just a generic shell question.

So use any method that a shell allows, for example

(echo command1 && echo command2 && echo command3) | sftp ...

Upvotes: 3

Related Questions