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