3 ms·
This is the whole promise of UNIX. Do something once? Write a shell on-liner at the console. Do it a second time? Save your one-liner to ~/bin or as a shell fun
by jitl 10y ago
This is the whole promise of UNIX. Do something once? Write a shell on-liner at the console. Do it a second time? Save your one-liner to ~/bin or as a shell function in your .${SHELL}RC. Need something more complex than a one-liner? Grab Ruby or another "loose" language that adds some sanity -- but importantly not too much.
When you build tools, try to add options to make my tools more flexible and amenable to scripting. Options like -z, to separate records on STDOUT with NULL, or having a trailing -- read input from STDIN, make tools much easier to script.
- pjmlp 10y agoShells and automating work were already a thing before UNIX was created.
- flukus 10y agoDid anyone else have the pipes and streams system that tied everything together?
- pjmlp 10y agoPipes are nothing more than function composition, already available in LISP systems since the late 50's. Using a UNIX shell is like a poor man's REPL without access to the OS internals. OS prior to UNIX already explored similar ideas by producing temporary files into cards, paper tape, tape and magnetic cores. Using a multi pass Algol compiler was an exercise in patience with the card data being fed into the multiple stages, effectively doing pipes via paper. Also UNIX pipes were influenced by the way pipes were designed in Multics. Streams, meaning dealing everything as bytes were just innovative in that UNIX provided no alternative, many of the previous OSes used to provide pure binary access (streams) and structured file access (records).
- gumby 10y agoLike so many things in Unix they came from Multics, although Unix originally didn't have them.
- enqk 10y agoThe officially known story is that pipes originated with Douglas McIlroy and they were implemented under that name in Unix by Thomson.
- gumby 10y agoThat may be the official story but I can tell you as a onetime Multics programmer, Multics definitely had pipes and as we all know Ken T worked on Multics before going back to Bell Labs.