[plug] Bash "Processing" Script
Jay Turner
jturner at bsis.com.au
Fri Jun 11 13:53:51 WST 2004
> On Friday 11 June 2004 12:35, Jay Turner wrote:
> > > Notwithstanding that this won't actually tell you that dd is
> > > actually doing its thing:
> > >
> > > ( while : ; do sleep 3 ; echo -n "." ; done ) &
> > > dotter=$!
> > > dd if=/dev/the_ universe of=black_hole bs=1planet
> > > kill $dotter
> > >
Bernd said:
> The shell's ":" is short-hand for "true", so
> while :
> will loop forever, at least until there's a break or exit inside the
> loop.
>
> $! is the process ID of the last process put into background.
>
> > I have not encountered them before in my bash experience..
>
Thanks Bernd
I have successfully implemented your code and it works fine.
Unfortunately, I am one of these people who needs to understand why
something
does what it does and not be happy just with the fact that "it does".
Your use of "shorthand" bash is still a little confusing for me, in that I
still code the long way
while [ true ]
do
sleep 3
echo -n "."
done
Am I reading it correct that the 'while' is in the background printing dots,
until we kill the 'while' process
which won't be done until after dd has finished?
If this is the case I am right in assuming that the brackets allow us to
group those statements together and have them all put into the background?
Can this be expressed in the "long way" of coding?
I feel a bit like Homer Simpson asking what do the letters V.I.P. stand for
right now..
Cheers
Jay
More information about the plug
mailing list