Re:Stop Piping Cats
by pyre on Thursday February 11, 2010 @01:15AM
(#1117046)
By the reasoning in your link, your suggestion of bash making 'cat' one of the built-in commands is the "cancer that's bloating UNIX."
[ Parent
| on HN ]
The shell has always been the kitchen sink full of glue holding the whole thing together. There have always been builtins: language control structures, job control, etc. -- there are some things you can't trust others not to fuck up, and where the coupling would just get ridiculous.
Here's cat as a pure sh builtin:
shcat {
for arg in "$@"; do
exec 3<>"$arg"
while read line <&3; do
echo "$line"
done
exec 3>&-
done
}
The shell by it's very nature can't just do exactly one task well, it's a programmable environment for living in. The cancer that's bloating UNIX was the way that the BSD and especially the GNU crews took simple tools and cross-pollinated them randomly with stupid shit. Try running "/bin/true --help" on a GNU system sometime -- there's a damn good reason why "your shell may have its own version of true". % /bin/true --help
Usage: /bin/true [ignored command line arguments]
or: /bin/true OPTION
Exit with a status code indicating success.
--help display this help and exit
--version output version information and exit
NOTE: your shell may have its own version of true, which usually supersedes
the version described here. Please refer to your shell's documentation
for details about the options it supports.
Report bugs to <[email protected]>.
I wouldn't necessarily call that 'bloated' unless you feel that any program that uses one bit more than absolutely necessary should be scrapped as 'bloated beyond belief.'> there's a damn good reason why "your shell may have its own version of true".
Because why exactly?