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

Re: brace expansion in ash?

Peter S Galbraith wrote:
> I was doing this in a Makfile:
>   install -m 644 debian/{0*,READ*,c*,gri*,watch} gri-2.6.0/debian
> and it turns out the brace expansion is a bashism, as ash doesn't
> support it.  Is there a sh-compliant way of doing this?  I looked

As you say, this is a bashism (also found, IIRC, in the csh family). 
The only option is to use character ranges and be careful in the
selection of the characters.  Using your 'install' example:

   install -m 644 debian/[0Rcgw]* gri-2.6.0/debian

But this would only work correctly if each letter in the range is unique
to the files you want.  For instance, the file 'Readme' would also match
but might not be part of what you want to install.

As possible alternative solutions, I believe it is possible to tell
'make' to use an alternate shell (though I don't know how off the top of
my head), or you could link bash to sh (OK for your own setup, but no
guarantees for other systems).

Bob McGowan
Staff Software Quality Engineer
VERITAS Software

Reply to: