write one small program to do one thing right
Every unix program i've seen is a monstrosity with enough options and man/info pages to drive people insane. http://www.go2linux.org/ls-man-page
ls does do one thing and does it well. It lists files.
$ ls
file1 file2 file3 filea fileb filec
Or it can list a single file.
$ ls file1
file1
Or it can list several files.
$ ls file1 file2 filec
file1 file2 filec
But ls doesn't have to support wildcards because those are provided by the shell.
ls *
file1 file2 file3 filea fileb filec
(ls never sees the asterisk, just the files)
But what if wildcards aren't sufficient for searching and the user needs regular expressions? ls doesn't have to provide those either, because the shell provides pipes (|), and grep provides regular expressions.
$ ls | grep '^.*[1-2]$'
file1
file2
ls doesn't have to worry about saving output to a file either, because that's also provided by the shell with >.
$ ls *[a-c] > file1
$ cat file1
filea
fileb
filec
Now let's say the user wants big letters like those provided by figlet?
Want to have a program where the cow tells you your fortune?
$ cat > cowfortune
fortune | cowsay
$ chmod +x cowfortune
$ mv cowfortune ~/bin
$ cowfortune
______________________________________
/ You look like a million dollars. All \
\ green and wrinkled. /
--------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
Do you get the idea? The UNIX philosophy to do one thing and do it well means that ls need not worry about every possible way to list files, and figlet, cowsay and rot13 need not know anything about listing files.
ls is an exception however, since it is THE most commonly used tool, therefore it provides some of its own conveniences like sorting, etc.
If you think Apple ][ and Commodore 64 are funner than UNIX, you're an accountant or a gamer, not a hacker, and you should probably go back to /g/.
Name:
Anonymous2011-10-02 18:45
>>13
10/10 post. I orgasmed just by reading it. Now if you excuse me, I have to go change my pants.
>>13
Not sure whether this is kopipe, but kudos for posting it. I am going to send this to someone every time they don't understand doing things the `UNIX way' (I'm sick of explaining it).
>>23
It's called `feature bloat' or `featuritis'. JWZ's Law of Software Envelopment: Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.
Name:
Anonymous2011-11-01 0:50
why not just compile the BSD coreutils source for Noobuntu?
>>26
I think most Linux distributions depend on GNU coreutils.
Name:
Anonymous2011-11-01 1:49
>>25
the # of options has nothing to do with option of unix programs
the option usually change the semantics of the function of the programs but don't agregate functions. a fine example of this is the "grep -c PATTERN" the use is the same, the semantics change from display text to count ocurrences on files. BTW one could argue the true intended use of grep is for "ocurrences of text"