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

Re: Emacs roulez, vi sux (était: Re: Ligne vide)



Le Wed, Mar 28, 2001 at 04:06:18PM +0200, Charles Goyard [charles.goyard@laposte.net] a écrit:
> > $ dd if=/dev/zero of=toto count=1 bs=10
> > 1+0 enregistrements lus.
> > 1+0 enregistrements écrits.
> > $ ls -l toto
> > -rw-r--r--    1 vitrac   vitrac         10 mar 28 15:49 toto
> > $ vi toto
> > :wq
> > $ ls -l toto
> > -rw-r--r--    1 vitrac   vitrac         11 mar 28 15:50 toto
> > 
> > Arg !! Il l'a fait ! Le vilain ! Ma côte de popularité vi vient d'en
> > prendre un coup. Il modifie des fichiers à l'insu de notre plein gré
> > :)
> 
> Même test avec xemacs : 10 octets avant et après.
> Mais d'une certaine manière, on s'éloigne du sujet.

Par défaut, vim (et vi en général) n'est pas "binary safe", c'est pour
ça qu'il y a une option "-b" :

[domi@triton] /tmp $ dd if=/dev/zero of=toto count=1 bs=10
1+0 records in
1+0 records out
[domi@triton] /tmp $ ls -l toto
-rw-r--r--    1 domi     domi           10 Mar 28 16:17 toto
$ vim -b toto
:wq
[domi@triton] /tmp $ ls -l toto
-rw-r--r--    1 domi     domi           10 Mar 28 16:18 toto

et voilà, 10 avant et après...

Dom
 
-- 
Dominique Rousseau <d.rousseau@nnx.com>          
Neuronnexion - http://www.neuronnexion.com            



Reply to: