home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!nucsrl!ddsw1!dattier
- From: dattier@ddsw1.mcs.com (David W. Tamkin)
- Subject: Re: How to empty a file
- Message-ID: <1992Aug28.051548.16935@ddsw1.mcs.com>
- Organization: Contributor Account at ddsw1, Chicago, Illinois 60657
- References: <17g4kbINN4bm@seven-up.East.Sun.COM> <BtLLps.But@cs.dal.ca>
- Date: Fri, 28 Aug 1992 05:15:48 GMT
- X-Disclaimer: Material posted in this article is the sole responsibility of
- the poster and does not represent MCSNet or the system owners.
- Lines: 20
-
- digdon@ug.cs.dal.ca (Mike Digdon) wrote in <BtLLps.But@cs.dal.ca>:
-
- | You could also do:
- |
- | echo > logfile
-
- That will not leave an empty file; the file will contain one newline and
- nothing else, but it won't be empty.
-
- If you'd like to use echo, you have to suppress the newline: usually that
- means
-
- echo "\c" > logfile # in Sys V or
- echo -n > logfile # in BSD. but
- : > logfile # is shorter to type and, so other posters say,
- # works even in shells where
- > logfile # doesn't.
-
- David W. Tamkin Box 59297 Northtown Station, Illinois 60659-0297
- dattier@ddsw1.mcs.com CompuServe: 73720,1570 MCI Mail: 426-1818
-