[plug] Bash "Processing" Script
Bernd Felsche
bernie at innovative.iinet.net.au
Fri Jun 11 12:16:48 WST 2004
On Friday 11 June 2004 12:02, Jay Turner wrote:
> I have written a bash script that I can use to image partitions from one
> disk to another using 'dd'.
>
> As this process can take a while and 'dd' doesn't offer any processing
> information, I was hoping to
> output a '.' to the screen every x seconds while 'dd' does it's thing.
> ie
>
> Imaging............
>
> With a new dot appearing after x seconds.
>
> Does anyone have any ideas on the best way to do this?
> Outputting the dots is simple, I just can't work out a way to be able to
> start a process (dd) and then keep outputting dots until dd returns an
> exit code (hopefully 0, but 1 also needs to be accounted for)..
> I wrote a script that appeared to be able to do all that however when I
> called 'dd' (actually 'sleep 15' for testing)
> the script would wait until 'sleep 15' finished before processing the
> rest of the script which contained the dot printing portion.
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
A "better" way would be to check to see if the output is growing
or if it's been updated every few seconds for a special file before
producing the dot.
--
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ / ASCII ribbon campaign | I'm a .signature virus!
X against HTML mail | Copy me into your ~/.signature
/ \ and postings | to help me spread!
More information about the plug
mailing list