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

Dash scripting / simple rexex substitution?



Hello list, 

I'm doing some initdrd tinkering and I'd like to keep dash in place. I
also want to keep as much bloat out of the initrd as possible, so
installing externals such as tr / awk / sed / grep is undesirable.

With bash, I can do simple regex substitution in strings, e.g.

string="123abc"

string=${string/[a-z]/}

string would then = 123

Dash complains of bad substitution with practically every trick I can
think to throw at it.

Is this just not in Dash's capabilities, or perhaps there has been a
contribution to put more 'meat' in string manipulation? I noticed in the
source its built in a modular fashion, for instance how printf and test
were added as built ins.. I just can't find much of a community around
it.

I tried to look in the source to see, but my C just isn't good enough to
be certain of anything.

Thanks in advance, 

-Tim



Reply to: