help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Bash is setting disposition of a signal, ignored upon en


From: Anoop Sharma
Subject: Re: [Help-bash] Bash is setting disposition of a signal, ignored upon entry to shell, to default
Date: Sat, 12 Jan 2013 22:59:14 +0530


On Fri, Jan 11, 2013 at 7:00 PM, Greg Wooledge <address@hidden> wrote:
On Fri, Jan 11, 2013 at 11:52:04AM +0530, Anoop Sharma wrote:
> I am testing on Ubuntu 12.04.1 LTS.
>
> I have narrowed down this issue a bit more. The problem is not seen when I
> include a "#! /bin/bash" in the script or if I use the command "bash -c
> test_1.sh".
>
> It is only seen when I rely on bash as ubuntu default command interpreter
> to work. I have verified that ubuntu does invoke the same bash as the
> command interpreter by including BASH_VERSION in the script.

I don't understand the last paragraph.  What are you actually doing?
Are you using #!/bin/sh in the script?  Are you typing "sh scriptname"
in a terminal window?  Are you omitting a shebang line altogether and
relying on some unspecified shell to guess how to handle it?

If you have configured your Ubuntu system so that /bin/sh points to bash
instead of dash, and if you're invoking your script with /bin/sh (symlink
to bash), then you should be aware that invoking bash under the name of
sh causes it to disable certain options.  But this is a lot of "ifs".

I have:
1. Not modified Ubuntu system.
2. Not included any #! in the script.
3. Ran the script as "./test_1.sh"

Last paragraph was indeed incorrect. What I mean is that when I include the line "echo $BASH_VERSION" in the script, it prints the correct bash version. And the bits about default command interpreter came because I was under the wrong impression that binfmt was playing some role in handling the case where #! is not included in the script. Today I discovered (http://unix.stackexchange.com/questions/50425/shell-scripts-are-still-working-without-sha-bang-line ) that I was mis-informed. 

However, as explained in the link above and seen in shell_execve() function in execute_cmd.c (bash source), the script should work if started from a bash shell.


With Thanks,
Anoop


reply via email to

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