For the last few days I’ve been exploring a couple of programs with a rather ancient history. (Well, thirty years is an aeon in computers…) They are both still in use today, so I guess they must be of some use. The following is likely a product of my oddball interests, so if you don’t share them neither of us should be bothered.
First (though actually the second that I encountered), has anyone played with the Extensible Shell (“es”)? @Donn, I see your name prominently in its mailing list early days. Are you still interested?
For a couple of days, I thought this was the shell I’ve been looking for all my computer life. I soon discovered some drawbacks, too, but it’s definitely something I’ll keep around – especially for scripts. Its syntax is a delight compared to bash.
One neat feature is that all variables are lists, not just strings. This turns out to be rather convenient for managing arguments and things. And structuring is done with braces, nested if needed, so it’s all nice and clean. I’ve been writing a few scripts in it, and it flows well.
The two most serious lacks are no job control, and a complete absence of arithmetic. Apparently the designers (according to the mailing list archive) thought the first was “unnecessary”. With a new terminal being easily popped up, OK, it is, but when I’m remotely logged in somewhere I tend to use ctrl-Z a lot. (I see on its GitHub site that someone wrote a job control patch, but I haven’t looked at it.) Being unable to compute indices into lists is a severe limitation. I hacked up a ‘calc’ command using ‘bc’, but I don’t know how well it will work.
I see that the es shell has a package on HaikuDepot, so it’s easy to check out. I came to it by a back road, so I built a slightly earlier version, but the differences are trivial – except that I tweaked my copy a bit, to initialize non-login as well as login shells. (I want some custom functions in scripts started from an icon, for one thing.)
This odyssey began when I started thinking again about Rob Pike’s Sam text editor – which is getting on for forty years old! I’ve been using its “Structural Regular Expressions” pretty well daily for over twenty years in my own app. (Which I’ve given up trying to persuade anyone else to use, but I can’t live without it…) Sam led to Plan9, which uses a shell ‘rc’, which became ‘es’, so that’s how my journey went.
I found a Linux Sam on GitHub, so I thought it worth playing with. Whether it could ever be brought to Haiku is another question. One unusual thing about the editor is that it’s in two parts: the sam engine and a GUI ‘samterm’. The GUI is X11-based, so a Haiku equivalent would be a complete rewrite, but ‘sam’ itself can be run from the command line and does in fact work in Haiku.
The power of sam lies in those structural regular expressions, which are not bound by lines like other RE tools. Makes it easy to select arbitrary desired segments of text to work on. Without a GUI, though, you really have no feedback, and it doesn’t even incorporate readline. With everything in one window it’s pretty hopeless. I made it a bit more usable by wrapping it in a Weaver configuration, with separate input and display TextViews, but it’s still far from ideal. I have used it a couple of times to do repetitive edits, but it’s not going to replace Koder or Pe!
I must say I’d love a visual editor that also had good RE selection. for the times when simple Search-and-Replace don’t suffice, but I have a feeling that creating a GUI for sam would be a major job.
Well, that was a long essay, probably of little interest to anyone else, but I had fun exploring those bits of history, and ES at least is a keeper.