SHARE
TWEET

Untitled

a guest Oct 21st, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. watchit() {
  3.     HOME=$(tput cup 0 0)
  4.     ED=$(tput ed)
  5.     EL=$(tput el)
  6.     ROWS=$(tput lines)
  7.     COLS=$(tput cols)
  8.     printf '%s%s' "$HOME" "$ED"
  9.     while true
  10.     do
  11.         CMD="$@"
  12.         ${SHELL:=sh} -c "$CMD" | head -n $ROWS | while IFS= read LINE; do
  13.             printf '%-*.*s%s\n' $COLS $COLS "$LINE" "$EL"
  14.         done
  15.         printf '%s%s' "$ED" "$HOME"
  16.         sleep 1
  17.     done
  18. }
  19.  
  20. watchit top -b -n 1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top