From owner-freebsd-questions@FreeBSD.ORG Thu Sep 18 07:33:08 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 7606F16A4B3 for ; Thu, 18 Sep 2003 07:33:08 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6343943FCB for ; Thu, 18 Sep 2003 07:33:07 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h8IEX68k067528; Thu, 18 Sep 2003 09:33:06 -0500 (CDT) (envelope-from dan) Date: Thu, 18 Sep 2003 09:33:06 -0500 From: Dan Nelson To: Karlsson Mikael HKI/SOSV Message-ID: <20030918143306.GF51544@dan.emsphone.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 5.1-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i cc: freebsd-questions@freebsd.org Subject: 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, 18 Sep 2003 14:33:08 -0000 X-List-Received-Date: Thu, 18 Sep 2003 14:33:08 -0000 In the last episode (Sep 18), Karlsson Mikael HKI/SOSV said: > What I just wanted to ask was if it's absolutely necessary for cat to > be able to work on directories. Or if it would be possible to simply > add a check to cat that tests if the "file" being opened is a > directory and then exits with an error message if that is the case. The source is in /usr/src/bin/cat; add some code to stat the file and fail if it's a directory. > The biggest problem for me as a "Unix" help-person at a company is to > always explain to newbies and less experienced users not to cat > directories as it usually scrambles or locks the whole terminal and > as they then turn to me to undo their mistakes. These small simple > things give our users bad thoughts about FreeBSD and often drives > them to use other OSs! I find that hard to believe. Do you also want to block catting of executables, gzipped files, jpeg files, database files, and audio files? No OS does that by default. Maybe you should teach them how to reset their terminals when they cat binary data; ^Jreset^J should work, assuming your TERM variable is set right. -- Dan Nelson dnelson@allantgroup.com