Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # from http://unix.stackexchange.com/a/66800
- function cpstat()
- {
- local pid="${1:-$(pgrep -xn cp)}" src dst
- [[ "$pid" ]] || return
- while [[ -f "/proc/$pid/fd/3" ]]; do
- read src dst < <(stat -L --printf '%s ' "/proc/$pid/fd/"{3,4})
- (( src )) || break
- printf 'cp %d%%\r' $((dst*100/src))
- sleep 1
- done
- echo
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement