Re: Cat a directory

[ Available lists | Index of freebsd-questions | Month of Sep 2003 | Week of 22 Sep 2003 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Warren Block <wblock@wonkity.com>
Date
22 Sep 2003 16:37:22
Subject
Re: Cat a directory
Message-ID
20030922172730.J22516@wonkity.com

In reply to

[ Hide this part ]
"Karlsson Mikael HKI/SOSV" <mikael.karlsson@hel.fi> wrote:

> 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 when they try to run ls
> on a file. But as I said earlier who cares, right? Other OSs have only
> had this for "a couple" of year so why would we!!!

This might all be based on a misunderstanding. Using cat on a directory
is not producing useless garbage. For example, try

cat /etc | hexdump -C # UUOC, I know

Section 18.02 in O'Reilly's "Unix Power Tools" (if you don't have it
already, get it) describes this in more detail.

Modifying cat so it couldn't do this would not be an improvement.

I hope this helps, and thanks for giving me the motivation to look it
up.

-Warren Block * Rapid City, South Dakota USA


Elapsed time: 0.221 seconds