[NTLUG:Discuss] bash shell programming follies

Richard Geoffrion ntlug at rain.lewisville.tx.us
Wed Jun 26 19:55:15 CDT 2002


OK, will someone explain what it was I did and why it affected my system the
way it did?

I am trying to do a fresh software RAID-1 install of Slackware 8.1.  There
is, of course, no support for this, but I'm banging my head anyway.  During
my adventures I decided that I wanted to watch the progress of
"/proc/mdstat".  I went about making a bash script called loop.  (and how it
was aptly named!)

[ # loop]
cat /proc/mdstat #show the raid device status
sleep 3            #pause three seconds
$0                #rerun this command
[/ # loop]

Ok...not only was I NOT able to break out of this, but when I went to
another term screen and did a 'ps  -aux' you can imagine the humor as I saw
hundreds of spawned '-sh' shells.

I finally renamed loop to stop the loop.

Does a shell script not end when it reaches the last line?

-Richard





More information about the Discuss mailing list