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

Re: :>



* Lucio <lcml@pixel.it> <
> [2004-11-12]:
>  Seguendo le istruzioni per passare da woody a sarge,

Mi dici dove le hai trovate?

>  ho imparato che il comando
> 
>  :> nomefile
> 
>  cancella i contenuti del file in questione. Il ">" dovrebbe essere 
>  semplicemente la redirezione dello standard output, ma il ":" che
>  cos'è?  "man :" dice che non c'è pagina di manuale per ":". "man
>  bash" è troppo lungo da leggere e non sono sicuro che contenga la
>  risposta.  Qualcuno mi sa togliere la curiosità?

Quel comando l'ho scoperto tempo fa [a mie spese ... :-( ]; poi l'ho
sempre adoperato senza i due punti iniziali. Ritengo che la fonte sia in
queste righe di 'man bash':

quote:

   Redirecting Output
       Redirection  of  output  causes  the  file  whose name results from the
       expansion of word to be opened for writing 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 noclobber option to the set
       builtin has been enabled, the redirection will fail if the  file  whose
       name  results  from the expansion of word exists and is a regular file.
       If the redirection operator is >|, or the redirection operator is > and
       the  noclobber  option  to  the set builtin command is not enabled, the
       redirection is attempted even if the file named by word exists.

unquote

A quel che mi risulta, infine, se hai impostato il set noclobber, puoi
sempre sovrascrivere usando:
$ cat newfile >! oldfile

Ciao.

-- 
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.    \\?//
 Fa' qualche cosa di cui non sei capace!"   (diceva Henry Miller) ]    (°|°)
 Ennio. (Please change . for .dot. and @ for .at. in my Reply-To)       )=(



Reply to: