[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RES: RES: [shell-script] Erro no shell script
From: |
Julio Cezar Neves - DATAPREVRJ |
Subject: |
RES: RES: [shell-script] Erro no shell script |
Date: |
Tue, 22 Feb 2005 16:45:36 -0300 |
Valeu a observação Fábio. O sh é proprietário e portanto o que o bash faz é
tentar uma emulação qdo este interpretador é chamado.
[ ]s,
Julio
Esta é a semana
Julio Neves nas Dicas-L
http://www.dicas-l.unicamp.br/dicas-l/
IMPERDÍVEL!!!
| -----Mensagem original-----
| De: Fábio Batista [mailto:address@hidden]
| Enviada em: terça-feira, 22 de fevereiro de 2005 16:21
| Para: address@hidden
| Assunto: Re: RES: [shell-script] Erro no shell script
|
|
|
| Retirado do man page do bash:
|
| If bash is invoked with the name sh, it tries to mimic the
| startup behavior of historical versions of sh as closely as possible,
| while conforming to the POSIX standard as well. When invoked as an
| interactive login shell, or a non-interactive shell with the --login
| option, it first attempts to read and execute commands from
| /etc/profile and ~/.profile, in that order. The --noprofile option
| may be used to inhibit this behavior. When invoked as an
| interactive shell with the name sh, bash looks for the variable ENV,
| expands its value if it is defined, and uses the expanded value as the
| name of a file to read and execute. Since a shell invoked as sh
| does not attempt to read and execute commands from any other startup
| files, the --rcfile option has no effect. A non-interactive shell
| invoked with the name sh does not attempt to read any other startup
| files. When invoked as sh, bash enters posix mode after the startup
| files are read.
|
|
| Fábio David Batista
| address@hidden
| http://nerd-o-matic.blogspot.com
|
| On Tue, 22 Feb 2005 16:18:51 -0300, Fábio Batista
| <address@hidden> wrote:
| > On 22 Feb 2005 14:50:07 -0300, Gustavo Chaves
| <address@hidden> wrote:
| > > >>>>> On Tue, 22 Feb 2005 13:29:32 -0300, "Renato L. Sousa"
| > > <address@hidden> said:
| > >
| > > > Hummmm... Estou usando o bash (/bin/bash), e pelo q
| vi o sh no linux é
| > > > um link pro bash, então deveria funcionar, não ???
| > >
| > > Acho que sim. Mas consegui reproduzir seu problema
| aqui. Também não
| > > entendi... parece que a bash não entende o redirecionamento de
| > > processos depois de um while...done.
| > Não é tão simples assim. sh é um link, sim, para o bash, mas o bash,
| > quando roda, idenfica com que linha de comando ele foi executado. Se
| > foi com sh, ele roda no "sh mode". Vejam:
| >
| > [fabio@elefante testes]$ cat subs_proc.sh
| > #!/bin/sh
| > while read dirname
| > do
| > echo "Diretório $dirname"
| > done < <(ls /home)
| >
| > [fabio@elefante testes]$ cat subs_proc.bash
| > #!/bin/bash
| > while read dirname
| > do
| > echo "Diretório $dirname"
| > done < <(ls /home)
| >
| > [fabio@elefante testes]$ ./subs_proc.sh
| > ./subs_proc.sh: line 5: syntax error near unexpected token `<'
| > ./subs_proc.sh: line 5: `done < <(ls /home)'
| >
| > [fabio@elefante testes]$ ./subs_proc.bash
| > Diretório anderson
| > Diretório andre
| > Diretório contabnet
| > Diretório fabio
| > Diretório felipe
| > Diretório fernando
| > Diretório graziele
| > Diretório jerry
| > Diretório michel
| > Diretório novelli
| > Diretório oracle
| > Diretório otavio
| > Diretório priscila
| > Diretório rosane
| > Diretório subversion
| > Diretório suprifattus
| > Diretório trac
| > Diretório zilio
| >
| > Fábio David Batista
| > address@hidden
| > http://nerd-o-matic.blogspot.com
| >
|
|
| ---------------------------------------------------------------------
| Esta lista não admite a abordagem de outras liguagens de
| programação, como perl, C etc. Quem insistir em não seguir
| esta regra será moderado sem prévio aviso.
| ---------------------------------------------------------------------
| Sair da lista: address@hidden
| ---------------------------------------------------------------------
| Esta lista é moderada de acordo com o previsto em
http://www.listas-discussao.cjb.net
---------------------------------------------------------------------
Links do Yahoo! Grupos