home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3671 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.3 KB  |  33 lines

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