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

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

RES: [shell-script] Indetacao com o operador de redirecionamento (<<)


From: Julio Cezar Neves - DATAPREVRJ
Subject: RES: [shell-script] Indetacao com o operador de redirecionamento (<<)
Date: Wed, 6 Oct 2004 10:13:37 -0300

Armando,
Acho que nao existe codigo limpo sem indentacao. A indentacao e uma das
caracteristicas necessarias ao bom programador e pensando nisso fizeram o
seguinte artificio para o here document:

for ....
 
   ftp -in <<-EOF
       ...
   EOF

done

O man diz que se o - e adicinado ao << entao todas as TABs precedentes sao
ignoradas. Veja o ultimo paragrafo do texto abaixo:
 
          <<[-]word     The shell input is read up to a line that is
                        the same as word, or to an end-of-file.  No
                        parameter substitution, command substitution
                        or file name generation is performed on word.
                        The resulting document, called a here-
                        document, becomes the standard input.  If any
                        character of word is quoted, then no
                        interpretation is placed upon the characters
                        of the document; otherwise, parameter and
                        command substitution occurs, \new-line is
                        ignored, and \ must be used to quote the
                        characters \, $, `, and the first character of
                        word.  
                        If - is appended to <<, then all
                        leading tabs are stripped from word and from
                        the document.

[ ]s,
Julio Cezar Neves
- Programa de Software Livre -
Tel:+55 21 2528-7070 / +55 21 8112-9988
Fax: +55 21 2528-7646
mailto:address@hidden


| -----Mensagem original-----
| De: Armando Roque [mailto:address@hidden]
| Enviada em: quarta-feira, 6 de outubro de 2004 09:45
| Para: address@hidden
| Assunto: [shell-script] Indetacao com o operador de redirecionamento
| (<<)
| 
| 
| 
| Senhores(as),
| 
| Existe possibilidade de indetar o trecho dentro do ftp abaixo?
| 
| for ....
| 
| ftp -in <<EOF
| ....
| EOF
| 
| done
| 
| Pois se ajustar o que estiver dentro do for com o redirecionamento o 
| script nao funciona! Retornando a mensagem:
| "line XX: syntax error: unexpected end of file"
| 
| Obrigado,
| 
| Armando
| 
| 
| ---------------------------------------------------------------------
| Esta lista nao admite a abordagem de outras liguagens de 
| programacao, como perl, C etc. Quem insistir em nao seguir 
| esta regra sera moderado sem previo aviso.
| ---------------------------------------------------------------------
| Sair da lista: address@hidden
| ---------------------------------------------------------------------
| Esta lista e moderada de acordo com o previsto em 
http://www.listas-discussao.cjb.net
---------------------------------------------------------------------
 
Links do Yahoo! Grupos




 


 


reply via email to

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