4 ms·
> Check out the UNIX man for tail, grep, ... to see how strange above quote about 'unix philosophy' is. The "UNIX philosophy" is good, it's just that UNIX does
by sdegutis 11y ago
> Check out the UNIX man for tail, grep, ... to see how strange above quote about 'unix philosophy' is.
The "UNIX philosophy" is good, it's just that UNIX doesn't really follow it.
The C and shell programs that make up UNIX commands are actually UNIX's own little programming language, complete with ad-hoc data types.
Look at `cat` for example. It might as well be `str + str...`. Or look at `grep`, it's basically `filter` or `reduce` at heart. But it has to do this per-line, and it has no metadata about the line, it literally just works on string contents. The `head` and `tail` commands aren't much different than `take` and `drop`. Heck there's even a `sort` command.
That's why shells that actually use a programming language (e.g. eshell) don't seem so crazy to me. To be honest, I use eshell way more than I use bash, and half the functions I use there are written in lisp rather than bash or C.
- lispm 11y ago> The "UNIX philosophy" is good, it's just that UNIX doesn't really follow it. It never did, beyond some examples in beginner books. > Look at `cat` for example. It might as well be `str + str...`. Or look at `grep`, it's basically `filter` or `reduce` at heart. Then look at the options of `cat`. On my Linux system cat has a -n option, which numbers the output lines. If it were following the 'UNIX philosophy', this option would not exist.
- qwertyuiop924 11y agoUNIX may have been about small commands ("cat -v", anybody?), but its most important property is COMPOSABILITY. You could use small programs to build larger programs, allowing you to do things by gluing together code that you would previously have to write new programs to do. It made this very easy, and you could also do it from within C, so it wasn't an either/or situation. This is something your namesake system could have learned to do. The Right Thing isn't always the right thing.
- pjmlp 11y agoThat was already available in Xerox PARC systems, by making use of function call composition in Interlisp-D REPL, Builders in Smalltalk transcript or live debugger in Mesa/Cedar. The UNIX composition is only a novelty for those that never saw other OSes that surfaced at the same time. After all UNIX just adopted the idea from MULTICS.
- dllthomas 11y ago"The UNIX composition is only a novelty for those that never saw other OSes that surfaced at the same time. After all UNIX just adopted the idea from MULTICS." One could certainly chain programs through intermediate files. My understanding has it that pipelines were new in Unix, and Wikipedia agrees: "The pipeline concept was invented by Douglas McIlroy and first described in the man pages of Version 3 Unix."
- pjmlp 11y agoYes the concept was popularized by UNIX, but anyone that spends time doing computer archeology will find similar patterns in other OSes, like the ones I listed. Don't forget that back then computing was developed in silos, with knowledge only shared at conferences or when researchers switched universities/companies. So it was quite common that researchers across the globe would come up with similar discoveries.
- qwertyuiop924 11y agoBut pipelines made it convenient, and the shell made it language-agnostic. One or the other was lacking in your other examples.
- dllthomas 11y ago"On my Linux system cat has a -n option, which numbers the output lines. If it were following the 'UNIX philosophy', this option would not exist." Gnu's not Unix. "The GNU coreutils version of this on my Linux box behaves this way" is not a good way of getting at finer points of what is or is not Unix-y. That said, -n exists in BSD cat as well. It's not required by POSIX, though.
- klibertp 11y agoMy thoughts exactly. There are implementations of cat which don't have '-n' option: http://git.suckless.org/sbase/tree/cat.c http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/cat.c Not only "Gnu's not Unix", it's also not that much interested in following "Unix philosophy". Which isn't that bad, from a user perspective: users want more capable tools, even if it impedes composability a bit.
- throwaway999888 11y ago> The "UNIX philosophy" is good, it's just that UNIX doesn't really follow it. Well you know what they say. Talk is cheap. Ideas are basically free. Following through is hard. Having an abstract ideal is worthless if you are just going to squirm and excuse yourself when you don't follow through on them. Which is basically what Unix does when you question whether it follows what it preaches.