Re: Echoing "dots"
From: Joe Halpin (jhalpin_at_nortelnetworks.com_.nospam)
Date: 06/25/03
- Next message: rakesh sharma: "Re: parse each line in a file"
- Previous message: David Thompson: "Re: [Long] about ksh93 (Was: Bourne Shell Programming on Windows)"
- In reply to: RCHJr: "Echoing "dots""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 25 Jun 2003 12:46:01 -0500
"RCHJr" <jaxharry.news.invalid@web2news.net> writes:
> I have a script to clean up some java processes that sometimes takes
> several seconds to finish. Some of my users have complained that
> they don't know if the command is running or not. I have seen
> other's scripts that continuously echo dots (. . . . . . ) while a
> script is waiting for a return (in my case, my script is waiting for
> [[ $? = 0 ]].
>
> Can anyone tell me how to make my script echo these dots while
> waiting for it to finish?
There are a number of threads about this on Google Groups (search for
"echoing dots". The main idea in them is to have a function run in the
background printing dots, until the program you're waiting for is
finished, then kill the background function.
A very minimal example is
#!/bin/ksh
printdots()
{
while [ true ];do
printf "."
sleep 2
done
}
printdots&
pdpid=$!
sleep 30
kill $pdpid
However, this doesn't handle things like killing the script before the
sleep is finished, etc. Take a look at the threads available on Google
for a lot more discussion.
Joe
- Next message: rakesh sharma: "Re: parse each line in a file"
- Previous message: David Thompson: "Re: [Long] about ksh93 (Was: Bourne Shell Programming on Windows)"
- In reply to: RCHJr: "Echoing "dots""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|