4 ms·
I’ve been thinking about what I’d want in a new shell for a little while. Suffice it to say: not this. This decides that the problem is mostly the unix command
by dan-robertson 7y ago
I’ve been thinking about what I’d want in a new shell for a little while. Suffice it to say: not this.
This decides that the problem is mostly the unix commands not working together the way the author would like but I’m already pretty happy with the way unix commands work, I know how to use awk and I have a bunch of tools for different kinds of structured data.
So instead I will go off topic and describe the new shell that I would actually like to see:
A shell is (at least as far as I’m concerned) a program for running other programs, and connecting them together. I would not constrain myself to running inside a fixed grid character terminal if I could help it.
The thing I would focus on is interactivity and modifiability of commands. Most of my time at a command line is doing one of two things:
1. Typing simple commands to e.g. start systems or query their state or otherwise poke them. Here command has a more traditional meaning than “invocation of a program which may do arbitrary things”.
2. Piecing together pipelines to extract some data and do things with it (first I write a command to get some data and probably pipe it into less, then I try writing a bit of sed on the end and piping that into less, then some awk, and so on until I have the pipeline I want)
For 1, I would want things to mostly work like bash.
For 2, I would want something more. Instead of using regular pipes, add an intermediate program (or use the shell). At first it can just hold onto the input as well as sending it to the output. That would make it easy to inspect what is going into a pipe. I guess it may eventually want to stop building memory usage so maybe it could have a large ring buffer instead. I would also like to be able to get some pv like behaviour to see progress. This could also be switched into something with lower overhead. I think it would all be reasonably cheap with splice, tee, and vmsplice (I’m not interested in support for non Linux platforms).
I’d want the ability to e.g. write my command with a trailing pipe, see some output, and then interactively add more stages to the pipeline
Ideally, I’d like an interactive awk-like tool where I can see the effect of my partly-written command as I write it.
I’d want ssh to be treated in a first-class reasonably transparent way where I don’t need to think about complicated quoting rules. But maybe somehow efficiently trying to avoid too much bandwidth or remote computation.
I think I would want it to mostly run inside emacs but able to spawn a fast terminal emulator automatically as necessary for large files or long lines (you may be surprised to know that a shell in emacs tends to give you much lower typing latency than typical terminal emulators because Mac’s handles its own rendering and line editing whereas a terminal emulator must send the key to bash through a pty which then sends back some terminal control codes which must be interpreted before the display may be rendered.