Last active
September 19, 2019 12:48
-
-
Save ichihara-3/76444d95fac1591dcbce4a604425eea3 to your computer and use it in GitHub Desktop.
rolling longcat. mattn/longcat must be installed: https://github.com/mattn/longcat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: ./rollingcat.sh INTERVAL TIMES | |
# mattn/longcat must be installed: https://github.com/mattn/longcat | |
if [[ $1 =~ ^[0-9]+(\.[0-9]+)?$ ]]; then | |
interval=$1 | |
else | |
interval=1 | |
fi | |
if [[ -n $2 ]] && [[ $2 =~ ^[0-9]+$ ]]; then | |
count=$2 | |
else | |
count=1 | |
fi | |
# hide cursor with CSI sequence | |
echo "\x1b[?25l" | |
for _ in $(seq ${count}) | |
do | |
for command in "longcat" "longcat -H" "longcat -R -r" "longcat -H -R -r" | |
do | |
lc=$(bash -c "${command}" 2>&1) | |
clear | |
echo ${lc}; | |
sleep ${interval}; | |
done | |
done | |
# show cursor with CSI sequence | |
echo "\x1b[?25h"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment