LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] bash bug?

[ILUG] bash bug?

Stephen Shirley diamond at skynet.ie
Fri Jun 14 12:12:50 IST 2002


Mornin' all,

	The following bash script fails to work as expected/desired:

---------------------------------
#!/bin/bash

function sleep_60 () {

    trap return 2

    echo 'Died.....restarting in 60....',`trap`

    i=0
    while [ $i -lt 60 ]; do
        echo -n '.'
        i=$((i+1))
        sleep 1
    done
}

while true; do
		#do stuff
        sleep_60
done
---------------------------------

It's supposed to allow ctrl-c to be pressed during the sleep_60 function, which
should just return, and all it well. However, it only works the first time. The
next time sleep_60 is called, the ctrl-c only seems to kill the 'sleep 1'. This
is on rh 7.3 + bash 2.05a.0(1)-release, rh 6.1 + bash 1.14.7(1), and debian
woody + bash 2.05a.0(1)-release.  

So, can anyone see any problems with the above script, or is it actually a bash
bug (or even something else)?

Steve
-- 
"Oh look, it's the Pigeon of Love."




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell