trap and kill animation properly
This commit is contained in:
@@ -48,12 +48,13 @@ function siprefix() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
CHARS="|/-__-\\"
|
trap "trap - SIGTERM && kill -- -$$" EXIT SIGINT SIGTERM
|
||||||
|
CHARS=( "| " "/ " " _ " " \\" " |" " \\" " _ " "/ " )
|
||||||
i=0
|
i=0
|
||||||
while true; do
|
while true; do
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
printf "\r%s\r" ${CHARS:$i:1} >&2
|
printf "\r %s\r" "${CHARS[$i]}" >&2
|
||||||
i=$(( (i + 1)%${#CHARS} ))
|
i=$(( (i + 1)%${#CHARS[@]} ))
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user