redirect SCP output to file

跟風遠走 提交于 2020-12-07 18:33:19

问题


I've tried:

scp -r file host:~/ 2>&1 | tee -a file.log
scp -r file host:~/ >file.log 2>&1
scp -r file host:~/ &>file.log 

and i only ever get a blank file. what am I doing wrong? the goal is to capture the output of the files transferred to the text file


回答1:


You can achieve this using script:

script -q -c "scp -r file host:~/" > file.log


来源:https://stackoverflow.com/questions/32637393/redirect-scp-output-to-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!