From owner-freebsd-questions@FreeBSD.ORG Sun Sep 21 23:08:22 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 AFCE916A4B3 for ; Sun, 21 Sep 2003 23:08:22 -0700 (PDT) Received: from gate.edelkey.net (gate.edelkey.net [213.138.147.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0337E43FF3 for ; Sun, 21 Sep 2003 23:08:21 -0700 (PDT) (envelope-from mikael.karlsson@hel.fi) Received: from stadi-fsin (213138134154.edelkey.net [213.138.134.154]) by gate.edelkey.net (8.12.9/8.12.9) with SMTP id h8M68JHQ018351 for ; Mon, 22 Sep 2003 09:08:19 +0300 Received: from [137.163.173.140]:48658 (EHLO ema.hel.fi) Internet Mail 6.0.35 Release) with SMTP; Mon, 22 Sep 2003 06:02:01 -0000 Received: from ema.hel.fi (ema.hel.fi [137.163.173.140]) by ema.hel.fi (8.11.7+Sun/8.11.2) with ESMTP id h8M686S04411 for ; Mon, 22 Sep 2003 09:08:06 +0300 (EEST) X-Map-MIXER-Originators: false To: freebsd-questions@freebsd.org From: "Karlsson Mikael HKI/SOSV" MIME-Version: 1.0 Date: 22 Sep 2003 09:06:00 +0300 Envelope-ID: JA8AAAAAAgMHPAABYQADV7qgzdhU@master.hel.fi Message-Id: In-Reply-To: <20030919083627.K99065@wonkity.com> References: <20030919083627.K99065@wonkity.com> X-Mailer: TeamWARE Connector for MIME Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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: Mon, 22 Sep 2003 06:08:22 -0000 Read my first post before reading this thing so you'll be on the right trac= k!!!! Warren Block wrote (19.9.2003 17:41): > >Says who=3F cat works fine on binary files. The problem you are having >is that people are using cat to *display* files. "Fixing" that problem >could break cat for its more standard use: cat binaryfile | filter | >etc. No, that's not exactly my problem as I wrote in my first post my problem is people using cat on directories. But then another guy came in with the bina= ry files. And as the problem is both I went with binary files. > >> Other *NIX systems seem to have done this to their cat program so why >> can't FreeBSD=3F > >See above. Try to run for example "cat /bin" in Linux, HP-UX, Solaris and other *NIXes= and I'm 90% certain that they will not show the directory but an error message saying something. But then FreeBSD spits out crap which I can't see the poi= nt of ever using anywhere even when piping a tube up your ass! But since newbi= es do this frequently it=20shouldn't be possible to do so. > >> and why is this already done to less and not cat=3F > >less is made to display files. =20It's the correct tool for the job. And you mean that cat is built to show directories and that's the right job= for cat. Man=20I must of mised that in school as I thought ls was meant to show directories, but hey that's my problem, right=3F So you mean you use ls to= show file contents and cat to show directories which workes fine, Or=3F Ruben de Groot wrote (19.9.2003 13:34): > >So why don't you for example alias cat to cat -v in your system profile >and login scripts=3F This will display non-printing characters so they are >visible and don't mangle terminal settings. So it's better for a newbie to get understandable jibrish from cat when run= on directories then an error message stating that they are trying to run cat= on a directory like ls says=20when they try to run ls on a file. But as I said= earlier who cares, right=3F Other OSs have only had this for "a couple" of year=20s= o why would we!!! > >Why not=3F I regularly use constructs like this: > >cat somebackup.tgz | ssh someserver "cd /somedir; tar xzf -" > Yes, but do you regularly pipe "cat /bin" to another program. If so, why=3F Because isn't cp ment to copy files and directories! >Because less !=3D cat. It has a completely different functionality. I'm aware of that! But as less doesn't show directory contents like ls does= n't show file contents I thought it would be a good example. > >> Dan Nelson wrote (18.9.2003 17:33): >> > >> >I find that hard to believe. Do you also want to block catting of >> >executables, gzipped files, jpeg files, database files, and audio >> >files=3F 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. No, I don't necessarily want to add all of that but the directory part woul= d be a good start. And while we're on the subject of different file types why doesn't ls support coloring of different file types like in Linux. As it wo= uld make finding certain files easier=20by coloring them differently depending= on their ending.