[Scottish] Trapping SIGINTR in shell scripts

Andrew Elwell andrew at elwell.org.uk
Wed Aug 25 09:30:31 BST 2004

Hi Folks,

I've got a "run-parts" shell script that runs all executables in a directory
that I use.

-- snip active bit--
for i in $1/* ; do
        [ -d $i ] && continue
        if [ -x $i ]; then
-- end section --

However what I want to happen is if I press ctrl-c (SIGINTR 2)
that my "run-parts" script doesn't stop, but the presently running script
below stops.

do I simply get my run-parts script to ignore ctrl-c
(ie trap "" 2)

or is it more complicated than this...

More information about the Scottish mailing list