[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re:[shell-script] Re: echo
From: |
NetStaRt |
Subject: |
Re:[shell-script] Re: echo |
Date: |
Wed, 6 Aug 2003 09:58:09 -0300 |
Sim... isto ajuda... mais nao resolve... pois o que eu
preciso é que seja pedido uma confirmação.
>
> ---------- Início da mensagem original -----------
> De: César A. K. Grossmann <address@hidden>
> Para: address@hidden
> Cc:
> Data: Tue, 05 Aug 2003 18:13:10 -0000
> Assunto: [shell-script] Re: echo
> --- Em shell-
address@hidden, "NetStaRt" <news.ckendy@b...>
> escreveu
> > Quando eu executo
> > echo AlgumaCoisa > arq.txt
> >
> > no arquivo arq.txt vai ficar a string AlgumaCoisa, ca
so
> > eu execute novamente, porem com uma string diferente,
o
> > conteudo vai ser sobrescrito. Como eu faço para o she
ll
> > pedir uma confirmacao?
>
> Buenas, eu não sei se dá para fazer com que ele peça co
nfirmação, o
> que dá é:
>
> 1. Usar o >>, que vai colocar a nova string no fim do a
rquivo, em vez
> de sobrescrever o arquivo original com um novo arquivo
só com aquele
> conteúdo.
>
> 2. Da página man do bash (um interpretador de shell pop
ular):
>
> Redirecting Output
> Redirection of output causes the file whose na
me results
> from the expansion of word to be opened for w
riting on
> file descriptor n, or the standard output (file
descriptor
> 1) if n is not specified. If the file does not
exist it
> is created; if it does exist it is truncated to
zero size.
>
> The general format for redirecting output is:
>
> [n]>word
>
> If the redirection operator is >, and the noclob
ber option
> to the set builtin has been enabled, the redire
ction will
> fail if the file whose name results from the exp
ansion of
> word exists and is a regular file. If the r
edirection
> operator is >|, or the redirection operator is >
and the
> noclobber option to the set builtin comman
d is not
> enabled, the redirection is attempted even if
the file
> named by word exists.
>
> Ou seja, dá para fazer com que a redireção simples falh
e, usando "set
> -o noclobber". Veja o exemplo abaixo:
>
> $ cat teste.txt
> teste
> $ set -o noclobber
> $ echo teste > teste.txt
> bash: teste.txt: cannot overwrite existing file
>
> []s
> --
> Cesar A. K. Grossmann ICQ UIN: 35659423
> O Maravilhoso Mundo do Linux 2.6 - Confira a tradução!
> http://www.LinuxByGrossmann.cjb.net/wwol26-ptBR.html
>
>
>
> -------------------------------------------------------
--------------
> Esta lista não admite a abordagem de outras liguagens d
e programação, como perl, C etc. Quem insistir em não seg
uir esta regra será moderado sem prévio aviso.
> -------------------------------------------------------
--------------
> Sair da lista: shell-script-
address@hidden
> -------------------------------------------------------
--------------
> Esta lista é moderada de acordo com o previsto em http:
//www.listasdiscussao.cjb.net
> -------------------------------------------------------
--------------
>
>
> Seu uso do Yahoo! Grupos é sujeito às regras descritas
em: http://br.yahoo.com/info/utos.html
>
>
>
---------------------------------------------------
NetStaRt
uin: 10545918
http://zonew.virtualave.net
This e-mail is send with 100% recyclable electrons.
__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/
- Re:[shell-script] Re: echo,
NetStaRt <=