[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with shell regex and Make
From: |
for . ad |
Subject: |
Re: Problem with shell regex and Make |
Date: |
Sun, 14 Feb 2010 19:39:08 +0100 |
User-agent: |
Internet Messaging Program (IMP) 3.2.8 |
Ok thanks, for this help.
Bob Proulx <address@hidden>:
> address@hidden wrote:
> > This not not work on GNU Make 3.81 :
>
> The problem is that you are using shell syntax specific to bash, ksh,
> other shells but isn't in /bin/sh. In order to use syntax that isn't
> portable shell syntax then you need to select a different shell. Or
> you need to use portable syntax available in /bin/sh only.
>
> > all:
> > if [[ "mystring" =~ "string" ]]; \
> > then echo "found"; \
> > else echo "not found"; \
> > fi
> >
> >
> > output :
> > /bin/sh: [[: not found
>
> The problem is that you are using syntax that isn't supported by
> /bin/sh. You have probably become used to programming in bash, ksh,
> or some other new shell that has that syntax. But make uses /bin/sh
> by default and that shell doesn't support the [[ ... ]] syntax.
>
> See this section of the manual where it discusses how your execution
> shell is selected.
>
> http://www.gnu.org/software/make/manual/make.html#Execution
>
> The program used as the shell is taken from the variable SHELL. If
> this variable is not set in your makefile, the program /bin/sh is used
> as the shell.
>
> I recommend using portable shell syntax in your Makefile.
> Alternatively you can specify your shell to be "SHELL = /bin/bash" or
> whatever but doing so may make it a hardship for anyone else to
> compile your code on their system if their system is different from
> yours.
>
> Bob
>