Re: extract array name from string
On 30 Apr., 10:13, pk <p...@pk.invalid> wrote:
> On Wednesday 30 April 2008 10:06, Janis wrote:
>
> > N="Variable1[30]"
> > echo ${N%%[[]*}
>
> Why not just
>
> echo ${N%[*}
>
> then?
$ sh -c 'N="Variable1[30]"; echo ${N%%[*}'
Variable1[30]
$ sh -c 'N="Variable1[30]"; echo ${N%%[[]*}'
Variable1
More reliable (with other shells).
Janis
|