2009/2/17 Fabiano Caixeta Duarte <[email protected]>: > 2009/2/17 sergiolinux1 <[email protected]>: >> 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.
