Re: Echoing "dots"

From: Joe Halpin (jhalpin_at_nortelnetworks.com_.nospam)
Date: 06/25/03


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



Relevant Pages

  • Script While net connection is alive, do
    ... I created a simple script like this: ... echo "Connection Still Active" ... waiting for input. ...
    (comp.unix.shell)
  • Re: Sound of j and z in Hindi films and songs
    ... "Official Policy" to remove the dots from j-dot etc, ... there was a practice of writing an anuswar on certain words like ... the dictionaries and the script followed later. ... I also notice that the more vibrant a language more tolerant it is. ...
    (rec.music.indian.misc)
  • Re: Perl thread question
    ... I was given a task that requires me to launch multiple executions of ... When I run this Perl script in the background, ... of my using Perl threads to begin with, ... you're in fact waiting for the result of one thread before starting ...
    (comp.lang.perl.misc)
  • Re: Iraqi road sign?
    ... >>> dots above. ... Kurdish uses jim with one dot over and one dot ... >> caucasian languages, circassian and perhaps avar and a few others use ... this script is still in use by diaspora ...
    (sci.lang)
  • Re: dial-up pppd time-out
    ... >while waiting for the pppd to start. ... That page will show you how to set up a dumb script, and more importantly, ... defaultroute lock noipdefault modem nodetach /dev/modem 115200 crtscts \ ...
    (alt.os.linux)