Hard to explain. If you're steeped in UNIX, you know the UnixWay. Some facets:
- Everything is scriptable, whether the author intended it to be or not.
- EverythingIsa file. (Unfortunately a lot of unix programmers take this too far and use files for everything instead of databases; GoogleFileSystem?).
- The "smart" way would be to have a low-end database that is implemented as files, but also allow switching to a full database without a significant rewrite of query code.
- Policy is not decided for you, or reasonable defaults are decided that you can replace with your own.
- Be responsible for what you're doing. You won't be second guessed and prompted. This is the price you pay for simplicity and an environment that isn't dumbed down.
- Configuration is done via text files that you can edit without complicated tools. Whenever sensible, data is in text files too. (PowerOfPlainText)
- You can do complicated things by gluing simple things together. (You don't give your editor a word-count or spell-check feature; you have separate word-counting and spell-checking programs, and teach your editor to talk to them.) (AlternateHardAndSoftLayers)
- Simple and consistent interfaces are good, but they do not generally excuse large and complex implementations. Complex systems are built on simple cores and not vice versa. (WorseIsBetter, LessIsMore)
- Simple and complex systems are better separated from each other, leading to layered rather than monolithic design. This is synergetic with the point above and is often mistaken for WorseIsBetter.
- write a script first (ie use sh/awk/perl instead of c)
- anything should be possible to be automated.
- You can break any of these rules.
TheArtOfUnixProgramming is a more extensive exposition of the
UnixWay.
Not everything is scriptable - just most things. You can't easily script ftp from the shell (at least not without expect or using perl.)
--
- ftp wasn't a Unix invention, it was first implemented by David L. Mills (protocol itself has a long history back to 1971, see http://www.faqs.org/rfcs/rfc959.html . As I recall, Mills probably implemented ftp for the BBN Internet prototype on a DEC 10, and it was then ported to Unix and other operating systems. One therefore may as well criticize Emacs for not having the UnixWay. Correct, it does not; it has the RMS/MIT way.
- Regardless of that, Under Unix, it is no less scriptable than any nominally interactive tool (like the editor ed) that normally one does not expect to fail. Expect is required with ftp primarily to add conditional handling of failures ("busy, try again later", etc). Below someone gave a perfectly valid example of a script to feed to ftp if errors are expected to be uncommon.
- Under TOPS 10, the original ftp was not scriptable, at all, period. This is a rather large difference.
Arguably a bug in ftp, and fixed by tools like curl (http://freshmeat.net/projects/curl).
But that's my point -- there's always a way. You don't have to wait for the original author to decide he wants to give you the ability to script his program. You can use a tool like expect to take care of that little problem. --MattBehrens
Surely:
ftp -n <<EOF
open ftp.example.org
user anonymous ${USER}@
cd /path/to/file
binary
passive
get file.gz2
EOF -- PerryLorier
CheapProcesses? mesh together with pipes to keep programs small and focused.
(Although GNU and Linux kinda breaks the small rule, and many new GUI programs now combine what separate text-based programs used to do) -- etoffi
Is this often referred to the UnixToolsApproach?? Its often better/simpler to write a bunch of small programs that interact with existing small programs via cli (or small sh script) than to build a monstrosity. Isn't that why '|'? -- SusanRoy
LinuxOs GraphicalUserInterface applications are often former non-UnixOs ProprietarySoftware? that was later OpenSourced and ported: e.g. OpenOffice and MozillaBrowser. After that it's a slow struggle to chunk things up and make them scriptable. With Mozilla they broke out Gecko so you can wrap Ephiphany/Galeon/whatever around it, now they're trying to make MozillaXul more flexible, etc. OpenOffice is proving to be a real PITA to work with in this regard; but it at least outputs XML ASCII now.
See also: PlanNineFromBellLabs, which tries to break fewer of the rules less often.
UnixCulturalAssumption, UnixDesignPhilosophy
See StandardWay. Contrast WindowsWay.
CategoryOperatingSystem