Convert multiple SFTP command lines to a single li

2020-03-31 07:51发布

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

sftp -v bheng@45.55.88.88 <<EOF
    mkdir /home/forge/web-app/public/backup/$HOSTNAME/$DATE
    put $path/* /home/forge/web-app/public/backup/$HOSTNAME/$DATE
    bye
EOF

1条回答
趁早两清
2楼-- · 2020-03-31 08:00

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 ...
查看更多
登录 后发表回答