3 ms·
Okay Yacc and Lex were not there that time is the reason? Now there are very much there, why is Sed still being used? Ok like in my cases forced to learn?
by digamber_kamat 17y ago
Okay Yacc and Lex were not there that time is the reason?
Now there are very much there, why is Sed still being used?
Ok like in my cases forced to learn?
- jacquesm 17y agobecause it works and because when you finally grok it it makes a warped kind of sense. Most old unix utilities are very concise and elegant but they are hard to love when you come from more friendly environments. Another reason why plenty of them are so sparse when it comes to command input is because you used to access these machines via serial lines (or god forbid teletypes) and any character you could save was worth it. Hence VIs 'homerow' approach (no mouse, no cursor keys).
- jrockway 17y agoWeren't "hjkl" cursor keys on the machine Bill Joy was writing vi on?
- jacquesm 17y agoYes, ctrl-h = backspace (go left), ctrl-j = linefeed (go down), ctrl-k = reverse linefeed (go up). The only miss in this scheme is ctrl-l which normally would be a form feed but it's easy enough to remember. When you look at it like that it makes perfect sense to put your cursor control on hjkl (at least for people that know the ascii control codes...). I don't know which modifier on the original keyboard made it work that way but I guess it was simply the control key (because that makes the most sense given the above). Would be nice to be sure though! (in vi it does the trick by not using a modifier at all, but by a mode switch). edit: here is a picture of the machine: http://www.vintage-computer.com/otheritems.shtml http://www.vintage-computer.com/otheritems.shtml (top one) You can barely make out the extra squiggles on the keyboard, above the h j k and l are the arrows. edit2: http://en.wikipedia.org/wiki/Vi http://en.wikipedia.org/wiki/Vi shows the keyboard in more detail (but gets the location of the arrows wrong), it is interesting that 'line-feed' (10) and 'enter' (13) have separate keys. Useful when you're copying from your terminal straight to a lineprinter and you want some extra space :)
- mahmud 17y agoNo one is forcing you, but Sed is part of the Posix standard. It's not the Unix way or the highway, you also have Perl and a host of other scripting languages that are better than the stock tools in Unices. The Lisp Operating System solved this problem by having a unified I/O format (S-expressions) and built the lexer and parser in the OS. The Lisp READ and WRITE operators are overloaded methods that parse and serialize Lisp code and data structures respectively. If your configuration syntax or programming language syntax is in fully-parenthesized prefix syntax (i.e. valid Lisp s-exps) you can read and write expressions, statements and functions (the grammar of which is all in your hands btw) right there in the shell, and from within all running programs. You could even redefine builtin functions from the shell. Imagine if you could shadow the definition of, say, fopen(3), the C function for opening FILE streams. You could instrument it to log all file access, and all the programs you fire up after this will have their access to files logged. You can have the functionality of ltrace(1) with in seconds. Ask your smart questions in google and get enlightened.
- digamber_kamat 17y agoSometimes I do find google better, atleast it comes with some relevant answers.