How to add a progress bar to a shell script?

后端 未结 30 2704
情歌与酒
情歌与酒 2020-11-22 05:48

When scripting in bash or any other shell in *NIX, while running a command that will take more than a few seconds, a progress bar is needed.

For example, copying a b

30条回答
  •  一个人的身影
    2020-11-22 06:46

    use the linux command pv:

    http://linux.die.net/man/1/pv

    it doesn't know the size if it's in the middle of the stream, but it gives a speed and total and from there you can figure out how long it should take and get feedback so you know it hasn't hung.

提交回复
热议问题