bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trap builtin ignores function named 'stop' as arg


From: Chet Ramey
Subject: Re: trap builtin ignores function named 'stop' as arg
Date: Thu, 6 May 2004 15:42:16 -0400

> Machine Type: i386-redhat-linux-gnu
> 
> Bash Version: 2.05b
> Patch Level: 0
> Release Status: release
> 
> Description:
> 
> Given "function stop() { ... }" in a bash script and "trap stop SIGINT"
> command later in the script, no "trap" is set. Also, the status returned
> by 'trap' command is 0.

This particular problem is caused by the fact that bash does not require
the  `SIG' prefix on a signal specification.  It will interpret `stop'
and `sigstop' as identical, and, in this case, reset the handlers for
SIGSTOP and SIGINT to their default values.

The easy workaround is to use

        trap ' stop' SIGINT

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]