From owner-freebsd-questions@FreeBSD.ORG Thu Sep 25 07:21:42 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B037A16A4BF for ; Thu, 25 Sep 2003 07:21:42 -0700 (PDT) Received: from clunix.cl.msu.edu (clunix.cl.msu.edu [35.9.2.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 898F044022 for ; Thu, 25 Sep 2003 07:21:38 -0700 (PDT) (envelope-from jerrymc@clunix.cl.msu.edu) Received: from clunix.cl.msu.edu (localhost [127.0.0.1]) by clunix.cl.msu.edu (8.12.9/8.12.9) with ESMTP id h8PEL0Og028336; Thu, 25 Sep 2003 10:21:01 -0400 (EDT) Received: (from jerrymc@localhost) by clunix.cl.msu.edu (8.12.9/8.12.9/Submit) id h8PEL0Gr028335; Thu, 25 Sep 2003 10:21:00 -0400 (EDT) From: Jerry McAllister Message-Id: <200309251421.h8PEL0Gr028335@clunix.cl.msu.edu> To: admin@asarian-host.net (Mark) Date: Thu, 25 Sep 2003 10:20:59 -0400 (EDT) In-Reply-To: <200309250342.H8P3GORP067610@asarian-host.net> from "Mark" at Sep 25, 2003 03:42:50 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org Subject: Re: Re:Re: Cat a directory X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Sep 2003 14:21:42 -0000 > > However, the purpose of "cat" is to write the contents of a file to STDOUT. > And yes, in UNIX pretty much everything is considered a file. But that does > not change the fact that people do not experience a directory as a file, and > in their use of language also clearly differentiate between the two. You > too. Besides, for the regular use of writing the contents of a directory to > STDOUT, "ls" was created. > > Using "cat /bin" is a poor example, because everybody KNOWS /bin is a > directory. But how about using a more realistic example? Say, "cat > /usr/libexec/sendmail"? That happens to be a directory, but could easily be > mistaken for a regular file (when found in a find output, for instance). And > then a lot of crap scrolls through your terminal, which is potentially > DANGEROUS. Just because you cannot fathom a legitimate situation in which a > cat on a directory was unexpected and unintentional, does not mean that > situation never occurs. > > I would like to see a switch added to cat, like "-d", which specifically > allows it to operate on directories too, for that once-in-a-million chance I > actually need a hex dump on the directory as file. In fact, that behavior is > already incorporated in the "rm" command: Again, rm is something very different. You just don't get it do you?! If you want a special flag to make cat treat directories specially, then go ahead and write it and submit it. BUT DO NOT CHANGE THE DEFAULT BEHAVIOR OF CAT OR YOUR MODIFICATION WILL BE REJECTED BECAUSE IT WOULD BREAK THOUSANDS OF SCRIPTS AND BE FOOLISH AND UNNECESSARY!!!!!!!! Now, either contribute something or be done with it. ////jerry > > The options are as follows: > > -d Attempt to remove directories as well as other types of files. > > So, in like fashion for "cat": > > -d Attempt to write the raw contents of a directory too. > > - Mark >