Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ucla-cs.ARPA Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!whuxlm!harpo!decvax!ittvax!dcdwest!sdcsvax!sdcrdcf!trwrb!cepu!ucla-cs!alex From: alex@ucla-cs.UUCP Newsgroups: net.unix,net.bugs Subject: Re: Creating a file in csh Message-ID: <4854@ucla-cs.ARPA> Date: Wed, 17-Apr-85 14:44:13 EST Article-I.D.: ucla-cs.4854 Posted: Wed Apr 17 14:44:13 1985 Date-Received: Fri, 19-Apr-85 01:39:44 EST References: <797@u1100a.UUCP> <254@tellab3.UUCP> <1581@ukma.UUCP> <1899@sdcrdcf.UUCP> <6177@Glacier.ARPA> Reply-To: alex@ucla-cs.UUCP (Alex Quilici) Organization: UCLA Computer Science Department Lines: 24 Xref: watmath net.unix:4280 net.bugs:620 Summary: In article <6177@Glacier.ARPA> reid@Glacier.ARPA (Brian Reid) writes: >Aw, come on, folks. "touch filename" is the best way to create an empty file. >All of these other schemes, involving echo and cat and what have you, >require that the poor person reading the code stop and think about what is >going on, but the "touch" program will (by definition) do nothing other than >create it. >-- > Brian Reid decwrl!glacier!reid > Stanford reid@SU-Glacier.ARPA Yes, but since "touch" won't truncate an existing file, and the other methods (using "echo" or "cat") will, they have the advantage that they more closely approximate the behavior of "creat(2)." In addition, because "echo" is a builtin in many shells and "touch" isn't, using "echo" to create a file avoids the overhead of creating a new process and is slightly more efficient. On our 4.1bsd derivative, "echo > foo" is twice as fast as "touch foo". Admittedly, not a big deal. Alex Quilici alex@ucla-locus ...{ihnp4, cepu, ucbvax}!ucla-locus!alex