[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shopt extglob
From: |
Philip Guenther |
Subject: |
Re: shopt extglob |
Date: |
Wed, 12 Oct 2011 09:04:51 -0700 |
On Wed, Oct 12, 2011 at 7:43 AM, Martin d'Anjou
<address@hidden> wrote:
> I am not sure whether this is a make or shell problem.
Neither.
> SHELL=/bin/bash
> all:
> $$'shopt -s extglob; ls !(foo)'
>
> make
> $'shopt -s extglob\nls !(foo)\n'
> /bin/sh: shopt -s extglob
> ls !(foo)
> : command not found
> make: *** [all] Error 127
>
>
> But when I type it in the shell, it just works:
> bash -c $'shopt -s extglob\n ls !(foo)\n'
That last line works because the $'...' word is subject to a round of
expansion by the shell you typed it in, *NOT* by the bash command that
is literally being run there.
It's as if you created a shell script that contained these two lines:
#!/bin/bash
$'shopt -s extglob\n ls !(foo)\n'
Do you see how that gets one less round of shell expansion than your
bash -c ... command? The makefile version is like the shell script,
lacking that outermost round of shell expansion.
Philip Guenther
- shopt extglob, Martin d'Anjou, 2011/10/12
- Re: shopt extglob,
Philip Guenther <=