Skip to content

Instantly share code, notes, and snippets.

@ichihara-3
Last active September 19, 2019 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ichihara-3/76444d95fac1591dcbce4a604425eea3 to your computer and use it in GitHub Desktop.
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
#!/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