Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a "wheel" while waiting for script to run 1

Status
Not open for further replies.

sunixadm

Technical User
Sep 20, 2001
73
DE
Hi,

I have several scripts (bourne, korn and perl) that require input from the user, evaluat the input and finally perform tasks based on menu selections.

I have also written a "wheel" function which displays a rotating cursor. When I execute the function, the wheel is displayed but, the script doesn't continue to the next expression or task in the script!!!

Because these scripts take several minutes to run, I would like for the "wheel" to be displayed while the users are waiting for the script to finish.

Additional information on getting this to work in bourne, korn and perl would be a great help.

Thanks!

-Joe
 
Hi

An example of what you tryed ? Would be possible to find a better solution for your case.

I usually do this :

Code:
sign=("/" "-" "\\\\" "|"); pozi=0
echo -n Working...
while read string; do
  # something to do
  echo -en "${sign[$pozi]}\b"; let pozi=(pozi+1)%4
done < inputfile
echo Ok

Feherke.
 
Hi

Or another way, with executing in background :

Code:
echo -n Working...
sleep 1000 &
pidtowait=$!
sign=("/" "-" "\\\\" "|"); pozi=0
while ps $pidtowait > /dev/null; do
  echo -en "${sign[$pozi]}\b"; let pozi=(pozi+1)%4
  usleep 100000
done
echo Ok

Feherke.
 
Hi Feherke,

Thanks for the quick reply!

I tried your code and got:
syntax error at line 2: `sign=' unexpected

:-(

-Joe
 
Code:
$|=1;

print "Please wait...\n";

my @twirl = qw ( - \ | / );

for (my $counter=1; $counter<5; $counter++)
{
  print "\b\b$twirl[$counter % 4] ";
  sleep 1;
}

print "Count done.";


Kind Regards
Duncan
 
Hi

I use [tt]bash[/tt] 2.05b and now I tryed again with the codes copied from my above posts, and stil works. Either from a script file, or directly from the [tt]bash[/tt] prompt.

Feherke.
 
Hi,

Thanks Duncan for the perl code, it worked fine.

I still can't get the other code to work..............

;-(
 
Hi sunixadm

thanks for the vote - i am sorry i can't help you write a shell script to do the same...


Kind Regards
Duncan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top