Afficher un message
Vieux 30/04/2008, 10h34   #6
Janis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
  Réponse avec citation
 
Page generated in 0,09371 seconds with 9 queries