Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2003 09:33:06 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Karlsson Mikael HKI/SOSV <mikael.karlsson@hel.fi>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Cat a directory
Message-ID:  <20030918143306.GF51544@dan.emsphone.com>
In-Reply-To: <JA8AAAAAAgFWOQABYQADV7qgzdhU@master.hel.fi>
References:  <JA8AAAAAAgFWOQABYQADV7qgzdhU@master.hel.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030918143306.GF51544>