How to best capture and log scp output?

前端 未结 9 1220
栀梦
栀梦 2020-12-31 01:55

I am trying to capture output from an install script (that uses scp) and log it. However, I am not getting everything that scp is printing out, namely, the progress bar. <

9条回答
  •  长发绾君心
    2020-12-31 02:48

    scp myfile user@host.com:. && echo success! 
    

    is very helpful but to write the message to a log file I changed it like this

    scp myfile user@host.com:. && echo myfile successfully copied! >> logfile 2>&1
    

    and this will write "myfile successfully copied!" message to the log file.

提交回复
热议问题