bug-gnu-utils
[Top][All Lists]
Advanced

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

gmake (or bash) execute a script with sh! (but shouldn't)


From: Gabriel Zachmann
Subject: gmake (or bash) execute a script with sh! (but shouldn't)
Date: 21 Dec 2000 15:33:01 GMT
User-agent: slrn/0.9.6.3 (IRIX)

My problem is that gmake/bash don't execute a script under the bash
when I start that shell script from the makefile by $(shell).
The problem occurs under Cygwin 1.1.4 with bash 2.04.1.

Here is a minimal makefile:

---- Makefile
#!gmake -R
#SHELL := /bin/bash --noprofile --norc --noediting                      #cygwin
SHELL := /hgdv/software/IRIX6/bin/bash --noprofile --norc --noediting   #irix
$(shell echo shell variable SHELL = $$SHELL >& 2)
$(shell ./myscript 1 2 3)
default:
        @echo
---- Makefile

and here is the minimal shell script:

---- myscript
echo '_'=$_ >& 2
echo SHELL=$SHELL >& 2
echo BASH_VERSION=$BASH_VERSION >& 2
echo BASH=$BASH >& 2
---- myscript

What really annoys me is that under Cygwin, I get the following output:

---- output under Cygwin
shell variable SHELL = /bin/bash
_=./myscript
SHELL=/bin/bash
BASH_VERSION=
BASH=
---- output under Cygwin

which means that the script is executed under the Bourne shell! :-(

I really would like to have my script executed with the bash.
[because of all the nice features.]

Under IRIX, I get the following output from 'make':

---- output under IRIX
shell variable SHELL = /bin/csh
_=/hgdv/software/IRIX6/bin/bash
SHELL=/bin/csh
BASH_VERSION=2.03.0(1)-release
BASH=/hgdv/software/IRIX6/bin/bash
---- output under IRIX

which is what I expected.

Both under IRIX and under Cygwin, gmake is of version 3.79.1.

I also tried to set & clear the executable flag of the shell script 'myscript' 
under Cygwin (it's an NT file system, so permission flags are actually
retained). That didn't change anything.

when I execute the shell script "by hand" like
'/bin/bash ./myscript 1 2 3'
then everything is fine, of course.

I *could* put in a #!/path/to/bash
in the first line of the script,
but that doesn't seem like the right solution.
In particular, since the path is different under IRIX and under Cygwin,
so that would complicate things a bit.

I suppose I *could* also write #!bash in the first line,
and put the path in the PATH variable.
Still, this sounds like a work-around to me ...

Any ideas? Is this a bug in gmake or in the bash?

TIA,
Gab.

-- 
/---------------------------------------------------------------------\
| Paradigm is a word too often used by those                          |
| who would like to have a new idea                                   |
| but cannot think of one.                                            |
|                     (Mervyn King, Deputy Governor, Bank of England) |
|                                                                     |
| address@hidden          address@hidden        address@hidden |
| www.igd.fhg.de/~zach/    www.gab.cx        __@/'                    |
\---------------------------------------------------------------------/



reply via email to

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