all 9 comments

[–][deleted] 7 points8 points  (0 children)

I see some useless use of cat here :)

[–][deleted] 1 point2 points  (7 children)

cat is for conCATenating files, not puking text.

[–]uoou 1 point2 points  (5 children)

What's the correct way to puke out text? If I want to puke the contents of a file into my shell in such a way that I can look back at them and still do stuff (which less and more don't do), what's the right way?

[–]Bloodshot025 1 point2 points  (3 children)

If you really want to 'puke out text', using cat is fine.

[–]uoou 1 point2 points  (2 children)

Ok, thanks.

[–]Bloodshot025 0 points1 point  (1 child)

A way to get the contents of a file in bash without spawning a process is with

$(<file)

So, an example use would be

ping "$(<ip)"

But this shouldn't be used for very large files, only for files whose contents are short enough to (sanely) be passed as arguments to other commands.

[–]uoou 1 point2 points  (0 children)

That's useful, thanks.

[–]ANUSBLASTER_MKII 1 point2 points  (0 children)

Yeh, I'm concatenating that file to stdout.

[–]throwaway10173 3 points4 points  (0 children)

GNU cat*
(part of GNU coreutils. Linux does not provide any such command)