|
From: | Bob Proulx |
Subject: | Re: [Help-bash] Bash is setting disposition of a signal, ignored upon entry to shell, to default |
Date: | Fri, 11 Jan 2013 12:31:31 -0700 |
User-agent: | Mutt/1.5.21 (2010-09-15) |
Anoop Sharma wrote: > I am testing on Ubuntu 12.04.1 LTS. Which by default will have /bin/sh symlinked to dash. lrwxrwxrwx 1 root root 4 Mar 29 2012 /bin/sh -> dash Unless you have taken action to modify the default configuration. If you have symlinked that to bash (sh -> bash) then it will use bash to implement the POSIX shell in bash's POSIX mode. > 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". Right. Because then you will be running bash in native mode. When using bash features that is "The Right Thing To Do". > 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. If bash is running from /bin/sh it will be running in POSIX mode. It will set BASH_VERSION but will disable bash specific features that conflict with the POSIX /bin/sh mode. The presence of BASH_VERSION does not indicate whether bash is running in native mode or not. $ set -o | grep posix posix on $ set -o | grep posix posix off > Any idea what could be going wrong? I think you are calling your script with "#!/bin/sh" instead of "#!/bin/bash" and therefore are only getting /bin/sh features. Instead call your bash script with "#!/bin/bash" if you are going to use bash features. (I tend to do the opposite and only use portable shell features. But this is the help-bash list after all and so most people here would recommend use bash features not avoid them.) Bob
[Prev in Thread] | Current Thread | [Next in Thread] |