Cat a directory

Chris Pressey cpressey at catseye.mine.nu
Mon Sep 22 08:51:55 PDT 2003


On 22 Sep 2003 09:06:00 +0300
"Karlsson Mikael HKI/SOSV" <mikael.karlsson at hel.fi> wrote:

> [...]
> 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? 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 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!!!

Mikael,

Please understand that FreeBSD is more oriented towards classicists,
luddites, and other sticks-in-the-mud, than propellerhead "early
adopter" users-to-be-friendly-to.  (At least, it used to be; I honestly
have no idea what's going on in 5.x these days.)

Anyway, why not write a script for these users along the lines of:

  #!/usr/bin/perl

  foreach $f (@ARGV)
  {
    if (-d $f) {
      print "cat: $f: is a directory\n";
      exit 1;
    }
  }
  system "cat @ARGV";

Also, I believe 'GNU ls', in the ports, supports coloured directory
listings.

-Chris


More information about the freebsd-questions mailing list