|
@ -3,7 +3,7 @@ |
|
|
# Clears the entire current line regardless of terminal size. |
|
|
# Clears the entire current line regardless of terminal size. |
|
|
# See the magic by running: |
|
|
# See the magic by running: |
|
|
# { sleep 1; clear_this_line ; }& |
|
|
# { sleep 1; clear_this_line ; }& |
|
|
clear_this_line(){ |
|
|
|
|
|
|
|
|
clear_this_line() { |
|
|
printf '\r' |
|
|
printf '\r' |
|
|
cols="$(tput cols)" |
|
|
cols="$(tput cols)" |
|
|
for i in $(seq "$cols"); do |
|
|
for i in $(seq "$cols"); do |
|
@ -16,7 +16,7 @@ clear_this_line(){ |
|
|
# Usage: erase_lines [AMOUNT] |
|
|
# Usage: erase_lines [AMOUNT] |
|
|
# See the magic by running: |
|
|
# See the magic by running: |
|
|
# { sleep 1; erase_lines 2; }& |
|
|
# { sleep 1; erase_lines 2; }& |
|
|
erase_lines(){ |
|
|
|
|
|
|
|
|
erase_lines() { |
|
|
# Default line count to 1. |
|
|
# Default line count to 1. |
|
|
test -z "$1" && lines="1" || lines="$1" |
|
|
test -z "$1" && lines="1" || lines="$1" |
|
|
|
|
|
|
|
@ -30,10 +30,10 @@ erase_lines(){ |
|
|
if [ "$lines" = 1 ]; then |
|
|
if [ "$lines" = 1 ]; then |
|
|
clear_this_line |
|
|
clear_this_line |
|
|
else |
|
|
else |
|
|
lines=$((lines-1)) |
|
|
|
|
|
|
|
|
lines=$((lines - 1)) |
|
|
clear_this_line |
|
|
clear_this_line |
|
|
for i in $(seq "$lines"); do |
|
|
for i in $(seq "$lines"); do |
|
|
printf "$UP" |
|
|
|
|
|
|
|
|
buildtin echo "$UP" |
|
|
clear_this_line |
|
|
clear_this_line |
|
|
done |
|
|
done |
|
|
fi |
|
|
fi |
|
|