Oh my shell

A couple of months ago, I took the PowerShell on Linux challenge. I failed that challenge. I couldn’t extend the shell the way I wanted to.

Fast forward to today, I found another shell that I like better. It is based on the ‘es’ shell, which is based on the ‘rc’ shell, which is a plan9 shell which was supposed to “fix” the flaws in bourne.

I heavily modified this shell to give it a reasonable command line experience. I thought I’d share this work here, since it sort of started here in the first place.

Here is the github repo and here are the rpm builds.

It needs some more prompt and completion extensions probably, since it’s not on the same level as the more popular shells (bash, zsh, fish).

What’s your favorite shell feature? (Besides the typical powershell answer of integrating with everything in the microsoft enterprise).

I find the hinting a bit annoying, but I like the completion features of other shells. The help/man page inline w/fish is sort of neat, but I’m not sure I would use it very often. That’s probably what I would do next.

Anyway, any feedback is appreciated.

1 Like

I use zsh. Some of the most important features to me (not exclusive to zsh):

  • History filter (start to type and up brings only commands that started like that)
  • Autocomplete select (double tab for a list of files that can be inserted)
  • Customizable Input prompt for local and ssh separately (Powerlevel9k)

I could probably think of more, but those are the ones i couldn’t live without.

Here’s my history complete in action. I’m typing alt-p to complete the history element. The ‘make’ hist complete is doing the same thing while the history list is being displayed.

Lets see if this gif posts…


Interesting. Really powerfull. It’s more than i’d need and a tad hard to find what you’d want from the looks of it.

My usecase is basically: I’m on that server, editing some files and reloading services to check. When i start typing “vim” the up key goes back through all commands that started with “vim” one at a time.
Not as powerfull, but easier for me to wrap my head around.

The problem with getting accustomed to shells other than bash, much like editors other than vi, is that most hosts don’t have them installed. If you only do work on your personal desktop then go crazy, otherwise it’s kind of a bad idea.


It could compress the list to just those matching the search instead of paging the entire list. I thought about adding another action to do that, like alt-o displays the compressed history list… and alt-p displays the entire list. I sort of like the context in the history, so I can see what I did around the same time.

Yeah, I tried hard to copy the feel of readline in bash. I think I got most of the features, for example, alt-p in bash also does history completion. I tried to extend bash readline rather than replace it.

I can see where you’re coming from and that it would probably work for most people. I’m just a vim guy. I hate hotkey combinations with a passion. I try to never have to press to keys at the same time (German uses a lot of Uppercase, but that’s about it).
It’s just personal preference.

The way i see it: Most shells don’t change the commands you use. They just add features to make your job faster or easier. I have never had a problem switching from ZSH to bash. I just take more time to do some things. But i use both daily, so maybe i’m just accustomed to both?

You use ‘bindkey vi’ in zsh? I do that as well. I don’t really know emacs that well. Emacs mode looks powerful in bash, though. You can define macros!

Favorite shell feature? probably double tap esc to make the command a sudo command.

That and git in the status line.

1 Like

The git status is easy to do, the double escape is probably a keybinding. That would screw up vi mode, but in emacs mode it could work.

1 Like

One feature i really like in csh is if you set up your prompt like so:

: hostname:/path/ ;

then you can copy and paste entire previous lines as the : is a comment character and the ; is an end of comment…

Haven’t checked to see if i can set up similar in bash or any other shell…

1 Like

Noted. An inline comment would need to matched by the lexer, I’d guess:
If it starts at column 1 and is a ‘:’, scan to the ‘;’ or ‘\n’

I’ve been using the right column for the input mode, though:

<-i == vi insert mode
<-e == emacs mode
<-c == vi comand mode
TAB == tab completion mode
/_? == history search mode

That disappears after you’ve hit the enter key, so maybe that doesn’t need to an inline comment.

1 Like

I added the git status in deshrc. It only updates on ‘cd’ and only displays when there is a .git directory present.

Displays [branch]~modified-files+index-changes in red or green on the right hand side of the screen.


1 Like

That’s pretty sweet.

I suppose I could go full nerd-fonts for the crazy glyphs like powerline9k.

I’ve avoided that simply because my favorite font is an old DEC font which doesn’t have any kind of fancy glyphs.

One other idea I had was to add an event loop to the shell. Most shells have pretty basic read-eval-print loops that block on the terminal input, unlike Node and powershell, which are designed from the ground up to be event processors. There is the “trap” command in bash/zsh which provide asynchronous signalling , similar to an event. The functional style of this shell allows binding functions with a lexical context of evaluation.

In many respects, this shell is the proto-powershell from '93. It provides 3 channels for functions to communicate, just like posh: object, stream, exit-status. In this shells case, the objects are simple lists which map to argc, argv[] well. In the posh case, you can define all sorts of typed entry points.

Es syntax

 x = `{cmd}  # the byte stream
 y = <={cmd} # the list object
 if {cmd}    # the error status

Bourne syntax

 x = `cmd`     # the bytes
 if cmd; then  # the error status