El dom, 08-07-2007 a las 12:47 -0500, Manolet Gmail escribió:
> hola amigos:
>
> tengo un array en bash con muchos elementos ...
>
> error[500]="Syntax error, command unrecognized."
> error[501]="Syntax error in parameters or arguments."
> error[502]="Command not implemented."
> error[503]="Bad sequence of commands."
> ....
>
> y quiero saber como puedo acceder a ellos y tambien al numero de su
> index, en realidad quiero hacer algo como
>
> if grep "$INDEX" archivo {
> echo ${error[$INDEX]}
> }
Estás usando sintaxis de otro lenguaje para el if, pero como llamas a la
variable está bien.
Te tendría que quedar algo así:
if [ $INDEX ]; then
echo ${error[$INDEX]};
fi
--
Gabriel Parrondo
GNU/Linux User #404138
GnuPG Public Key ID: BED7BF43
JID: [EMAIL PROTECTED]
"The only difference between theory and practice is that, in theory, there's no
difference between theory and practice."
signature.asc
Description: Esta parte del mensaje está firmada digitalmente

