Code
spin() {
sp="/-\|"
printf " "
sleep 0.2
while true; do
printf "\b%.1s" "$sp"
sp=${sp#?}${sp%???}
sleep 0.2
done
}
Usage
#!/bin/sh
spin() {
.
.
.
}
printf "Hacking NASA "
spin &
spinpid=$!
trap 'kill $spinpid' SIGTERM SIGKILL
{
# You can run all the command you want here. I will only run sleep command.
sleep 5
} >/dev/null 2>&1
kill $spinpid
printf "\b \t[done]\n"
printf "NASA has been successfully hacked!!!\n"
exit 0
Example
