47 lines
1.2 KiB
Plaintext
Executable File
47 lines
1.2 KiB
Plaintext
Executable File
function rotate
|
|
{
|
|
# PURPOSE: This function is used to give the end user
|
|
# some feedback that "something" is running. It gives
|
|
# a line rotating in a circle. This function is started
|
|
# as a background process. Assign its PID to a variable
|
|
# using
|
|
# rotate & # To start
|
|
# ROTATE_PID=$! # Get the PID of the last
|
|
# # background job
|
|
#
|
|
# At the end of execution just break out by
|
|
# killing the $ROTATE_PID process. We also need
|
|
# to do a quick "cleanup" of the leftover line of
|
|
# rotate output.
|
|
#
|
|
# FROM THE SCRIPT:
|
|
# kill -9 $ROTATE_PID
|
|
# echo "\b\b "
|
|
|
|
INTERVAL=1 # Sleep time between rotation intervals
|
|
RCOUNT="0" # For each RCOUNT the line rotates 1/8
|
|
# cycle
|
|
|
|
while : # Loop forever...until this function is killed
|
|
do
|
|
(( RCOUNT = RCOUNT + 1 )) # Increment the RCOUNT
|
|
|
|
case $RCOUNT in
|
|
1) echo .-."\b\c"
|
|
sleep $INTERVAL
|
|
;;
|
|
2) echo .\\."\b\c"
|
|
sleep $INTERVAL
|
|
;;
|
|
3) echo "|\b\c"
|
|
sleep $INTERVAL
|
|
;;
|
|
4) echo "/\b\c"
|
|
sleep $INTERVAL
|
|
;;
|
|
*) RCOUNT="0" # Reset the RCOUNT to "0", zero.
|
|
;;
|
|
esac
|
|
done
|
|
} # End of Function - rotate
|