echo "put file.txt" | sftp -b - servername &
如果我理解正确的话。
echo "put file.txt" | sftp username@hostname ctrl-z bg disown