How to best capture and log scp output?

前端 未结 9 1228
栀梦
栀梦 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:45

    It looks like your just missing whether the scp was succesful or not from the log.

    I'm guessing the scroll bar doesn't print to stdout and uses ncurses or some other kind of TUI?

    You could just look at the return value of scp to see whether it was successful. Like

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

    man scp says

    scp exits with 0 on success or >0 if an error occurred.
    

提交回复
热议问题