Simple bash problem.

Simon Ashford Simon.Ashford at npl.co.uk
Mon Jan 29 00:11:31 UTC 2007


Thanks for the quick reply.

Unfortunately it made no difference putting #!/bin/bash...

This works on every other system I've tried.


-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com]On Behalf Of Miskell, Craig
Sent: 29 January 2007 00:07
To: General Red Hat Linux discussion list
Subject: RE: Simple bash problem.


> Anyone know why the following simple bash script fails
> on RHEL3 (fully patched)?  It seems the "trap" command
> is being silently ignored.
>
>
> --------------------------------------------
> #!/bin/sh
>
> sigtrap () {
>     echo "Caught signal!"
>     exit 0
> }
>
> trap sigtrap 1 2 3 15
>
> while read X; do
>     echo $X
> done
> --------------------------------------------

I'm not 100% sure, but I think it might be because of the #! Line.  Bash
might be seeing that you've invoked with "/bin/sh", and is deciding to
operate in limited POSIX shell mode (sorry, the exact terminology for
that escapes me).  Try #!/bin/bash and see how that goes,

Craig
=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Serco House, 16 Bartley Wood Business Park,
                   Hook, Hampshire, United Kingdom  RG27 9UY
-------------------------------------------------------------------




More information about the redhat-list mailing list