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

Re: [OT] Una de Bash



2011/8/15 Camaleón <noelamac@gmail.com>:
> Hola,
>
> El otro día me di cuenta de que un script que tengo en bash no funcionaba
> al ejecutarlo en wheezy (en lenny corre sin problemas).
>
> hpc03@stt300:~/Escritorio$ echo $SHELL
> /bin/bash
>
> hpc03@stt300:~/Escritorio$ cat test.sh
> #!/bin/bash
> declare -a Test=("elemento 1" "elemento 2");
> echo ${Test[@]}
>
> hpc03@stt300:~/Escritorio$ sh test.sh
> test.sh: 2: Syntax error: "(" unexpected
>
> hpc03@stt300:~/Escritorio$ declare -a Test=("elemento 1" "elemento 2"); echo ${Test[@]}
> elemento 1 elemento 2
>
> ¿Qué está pasando?
>

probá "ls -l /bin/sh"

Por lo que tengo entendido el shell en wheezy es "dash", no "bash". Y
si ejecutás tu script con "sh test.sh" no importa el "shebang" que
tenga, se va a ejecutar con /bin/sh . La otra es hacer el script
ejecutable y ejecutarlo con "./test.sh" (que sí respeta el "shebang")

Saludos,
Toote
-- 
Web: http://www.enespanol.com.ar


Reply to: