Re: [dev] cat -v

From: Mateusz Okulus <mmokulus_AT_gmail.com>
Date: Sun, 30 Jan 2022 22:13:52 +0100

On 22/01/30 06:40PM, inasprecali_AT_disroot.org wrote:
> Why is cat -v considered bad? I see that people often bring up
> this particular example as a way to illustrate bad extensions, but
> what exactly makes it so?
>

cat stands for conCATenate, which means to link together. The purpose is
to combine multiple files into a single stream.

cat -v shows nonprinting characters. It has nothing to do with
concatenating files.

If you want to see what's in a file, use a pager like less or text
editor like vim. Both programs display like cat -v, in color, and
probably by default. And cat -v is kind of broken, because it can't show
you difference between real  and ^X (two characters ^ and X).

cat is misused often. People seem to use it to view files. That's also
where you get "useless use of cat from". A pager or text editor is for
viewing files. cat is for concatenating.

I don't know the history, maybe there was some good reason. But right
now it'd be bad to use it. Can't tell ^X from . And files rarely are
smaller than a screen, so you need pager/editor anyways, to see whole
file.

Hope it was somewhat helpful. Maybe someone more experienced will add
something.

Regards,
mat
Received on Sun Jan 30 2022 - 22:13:52 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 31 2022 - 02:12:07 CET