From owner-freebsd-questions Sun Mar 28 1: 8:40 1999 Delivered-To: freebsd-questions@freebsd.org Received: from alpha.comkey.com.au (alpha.comkey.com.au [203.9.152.215]) by hub.freebsd.org (Postfix) with SMTP id 1640014F35 for ; Sun, 28 Mar 1999 01:08:17 -0800 (PST) (envelope-from gjb@comkey.com.au) Received: (qmail 13536 invoked by uid 1001); 27 Mar 1999 22:33:56 -0000 Message-ID: <19990327223356.13535.qmail@alpha.comkey.com.au> X-Posted-By: GBA-Post 1.04 06-Feb-1999 X-PGP-Fingerprint: 5A91 6942 8CEA 9DAB B95B C249 1CE1 493B 2B5A CE30 Date: Sun, 28 Mar 1999 08:33:56 +1000 From: Greg Black To: dissonant Cc: freebsd-questions@FreeBSD.ORG Subject: Re: empty a file? References: In-reply-to: of Sat, 27 Mar 1999 04:48:11 PST Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Sorry to ask a dumb unix question....but, is there any easy way, in the > shell or in a script of some sort, to empty a file, leaving its > permissions, uid/gid, etc, untouched? The two traditional idioms (for scripts and interactive use) are: cp /dev/null your.file : >your.file Being a minimalist, I prefer the second one :-) It's possible to save a couple of characters in the minimalist version, but that tends to lead to obscurity for no real gain. -- Greg Black To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message