Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jul 2005 23:51:21 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Xu Qiang <Qiang.Xu@fujixerox.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: 1 byte more?
Message-ID:  <20050720045121.GB94371@dan.emsphone.com>
In-Reply-To: <20050720044345.04C111D969@imss.sgp.fujixerox.com>
References:  <20050720044345.04C111D969@imss.sgp.fujixerox.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050720045121.GB94371>