1 byte more?

Dan Nelson dnelson at allantgroup.com
Wed Jul 20 04:51:22 GMT 2005


In the last episode (Jul 20), Xu Qiang said:
> In FreeBSD 5.3, I want to create a new txt file with vi, and type a
> single digit into it, and save it for future use.
> 
> My steps are: 
> 1 vi count.txt
> 2 type i (for insert mode)
> 3 type 0
> 4 Esc
> 5 :wq
> 
> Then by "ls -l", I found the file's size is 2 bytes, intead of 1 byte
> as I expected.

vi probably put a newline character after the one you typed.  You can
use

  echo -n 0 > count.txt 

or a text editor that doesn't force a newline as the last character in
a file (joe for example).

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list