问题
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