shell-script-pt
[Top][All Lists]
Advanced

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

Re: [shell-script] sintax de array em script


From: Andrea VB
Subject: Re: [shell-script] sintax de array em script
Date: Tue, 17 Feb 2009 16:10:49 -0300

Ops... ignorem meu e-mail. Li rapidamente o e-mail do Sergio e achei
que ele estava usando "$array" pra definir a variável. Relendo vi que
o "$" era do prompt mesmo.

Desculpem qualquer coisa!

2009/2/17 Andrea VB <address@hidden>:
> 2009/2/17 Fabiano Caixeta Duarte <address@hidden>:
>> 2009/2/17 sergiolinux1 <address@hidden>:
>>> Olá lista,
>>>
>>> Estou tendo dificuldades para utilizar arrays "dentro" do shell script.
>>>
>>> Se eu utilizar esses comandos na linha de comando funciona beleza,
>>> ex.  $array=( zero one two three four five ) e $echo ${area[2]}
>>> como está na pagina abaixo,
>>> http://tldp.org/LDP/abs/html/arrays.html
>>>
>>> Mas se eu utilizar dentro do shell dá error como 2: Syntax error: "("
>>> unexpected ou 9: Bad substitution.
>>>
>>> Se eu copiar e colar o exemplo da pagina em um shell e rodar ele
>>> também da erro.
>>>
>>> Alguem pode me explicar onde estou errando?
>>>
>>> Obrigado a todos.
>>
>> Aparentemente não está errando.
>>
>> cat teste.sh
>>
>> array=( zero one two three four five )
>> echo ${array[2]}
>>
>> ./teste.sh
>> two
>>
>> Ou seja, está certo e funcionou :P
>
> Na mensagem original tava "$array=( zero one two three four five )" e
> não "array=( zero one two three four five )". Por isso que pra vc deu
> certo e pra ele não. :)
>
> --
> Andrea VB
> Please, don't CC me when replying to me on the lists, and use BCC when
> sending mass e-mails.
>



-- 
Andrea VB
Please, don't CC me when replying to me on the lists, and use BCC when
sending mass e-mails.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]