LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   making the cursor spin (https://www.linuxquestions.org/questions/programming-9/making-the-cursor-spin-305415/)

box_l 03-24-2005 05:05 AM

making the cursor spin
 
hi,
i am looking to find out how to make the cursor spin to show that you are waiting for a process to finish.

i see it when knoppix is booting.

looks like these characters.

|
/
-
\
|
/
-

TIA

BoX

keefaz 03-24-2005 05:22 AM

This is a little try :
Code:

clear
for i in  '|' '/' '-' '\\' '|' '/' '-'; do
    tput cup 4 20
    echo $i
    sleep 1
done


druuna 03-24-2005 05:25 AM

Hi,

Something like this maybe:
Code:

#!/bin/sh

sleep 10 &
pid=$!

printf "Processing |"
rotate='|/-\'

while kill -n 0 $pid 2>/dev/null; do
    rotate="${rotate#?}${rotate%???}"
    printf '\b%.1s' "$rotate"
    sleep 1
done
echo ''

wait $pid

echo "All done"

Hope this gets you going again.

box_l 03-24-2005 05:39 AM

thank you both for your quick replies.

you have both given me something to work on.

BoX


All times are GMT -5. The time now is 04:49 AM.