6 ms·
RC – The Plan 9 Shell (c. 1990) [pdf]
- i80and 6y agoOh, rc is a cool shell with a pretty chill codebase to work in! For kicks and giggles I hacked in a bunch of toy features like try...catch and linenoise support to it 5 years ago! https://github.com/i80and/rcish https://github.com/i80and/rcish
- jsrcout 6y agoLooks nice, will try it out! Local variables in particular is probably the main feature I miss in rc.
- i80and 6y agoCaveat emptor :D I wrote this fresh out of college. Locals usage is shown in https://github.com/i80and/rcish/blob/master/trip.rc#L600-L616 https://github.com/i80and/rcish/blob/master/trip.rc#L600-L61... I would love to do a from-scratch implementation someday, but alas, time is scarce.
- chubot 6y agoThe section following this quote is good: The most important principle in rc’s design is that it’s not a macro processor. Input is never scanned more than once by the lexical and syntactic analysis code And they describe the IFS=/ hole for setuid programs which is a good one. Oil follows the same principle, which I call static parsing [1], versus the dynamic parsing or undecidable parsing of Bourne shell and all its derivatives like bash. (A notable difference is that Oil compatible with POSIX, Bourne shell, ksh, and bash, while rc is not.) I probably got that idea from rc shell without realizing it, as I remember reading this paper more than 10 years ago. ---- I also recently picked up Programming Perl (by Christiansen, foy, Larry Wall), and it points out the same issue with shell multiple times: In Chapter 20 on security: Unlike most shell programming languages, which are based on multiple, mysterious substitution passes on each line of the script, Perl uses a more conventional evaluation scheme with fewer hidden snags. However, this is not entirely true, because there are corners of Perl that have undecidable parsing [2] I heard Larry Wall say that one of the goals of Perl 6 was to really fix this problem. It doesn’t do dynamic parsing like Perl 5 does. Also, back in January 2019, I rediscovered a security problem due to dynamic parsing which appears in all Bourne-derived shells (and at least the OpenBSD shell actually patched it, not sure about bash): http://www.oilshell.org/blog/2019/01/18.html#a-story-about-a-30-year-old-security-problem http://www.oilshell.org/blog/2019/01/18.html#a-story-about-a... https://github.com/oilshell/blog-code/tree/master/crazy-old-bug https://github.com/oilshell/blog-code/tree/master/crazy-old-... The guy who discovered ShellShock in 2014 wrote a few of the StackOverflow answers there. ---- Plug: tell me what you think of Oil’s syntax :) [3] [1] https://www.oilshell.org/release/0.8.2/doc/syntactic-concepts.html https://www.oilshell.org/release/0.8.2/doc/syntactic-concept... and http://www.oilshell.org/blog/2016/10/22.html http://www.oilshell.org/blog/2016/10/22.html [2] http://www.oilshell.org/blog/2016/10/20.html#appendix-parsing-c-perl-and-make-is-also-undecidable http://www.oilshell.org/blog/2016/10/20.html#appendix-parsin... [3] https://www.oilshell.org/release/0.8.2/doc/syntax-feelings.html https://www.oilshell.org/release/0.8.2/doc/syntax-feelings.h... (copy of lobste.rs comment)
- lizmat 6y agoThank you for your mention of Perl 6. Please note that Perl 6 has been renamed to Raku (https://raku.org https://raku.org using the #rakulang tag on social media).
- mkovach 6y agoI use rc quite often for a default shell when circumstances allow me. Heck, I hacked up rc-httpd, a web server written with rc, for a few projects and it work out nicely.
- dang 6y agoAnybody know the date of this?
- pvg 6y ago1990 for something fairly similar. https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.3287 https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.... This version is maybe the one included in the 2nd edition Plan 9 release from 1992. 1990 seems good enough and righter.
- thinkingkong 6y agoSame author of Duffs Device! https://en.wikipedia.org/wiki/Duff%27s_device https://en.wikipedia.org/wiki/Duff%27s_device
- jsrcout 6y agoI used rc as my primary shell for many years. Day-to-day usage is pretty similar to sh honestly. It has an extremely "clean" syntax, and handles command arguments containing white space correctly - particularly useful for scripting. Always hoped it would see broader usage.
- floren 6y agoI still use it day-to-day, probably about equally with bash. I appreciate that it gets out of the way and has pretty straight-forward quoting rules (which always screws me up in Bourne shells). When I write scripts for my own consumption, I like to write them in rc. Unfortunately, it doesn't have enough bells or whistles to support an "Awesome RC!" site or similar, providing hypercolor prompts and the like, so I don't know that it'll get broad usage like bash/zsh/fish :)
- mcguire 6y agoThat would be es (https://wryun.github.io/es-shell/ https://wryun.github.io/es-shell/).
- hanche 6y agoI used es as my login shell for over 20 years, until I switched to elvish a couple years ago. I only gave up on it due to some signal handling problem that I never managed to figure out. Other than that, however, it gave me all the flexibility and power I wanted, and no nasty surprises.
- deleted 6y ago[deleted]
- bhaavan 6y agoWhat does rc stand for, and how did we get bashrc and zshrc as config files for bash?
- floren 6y agoApparently "run commands" in both cases, see https://en.wikipedia.org/wiki/Run_commands https://en.wikipedia.org/wiki/Run_commands