For me, the most important part of this change is that the history behaviour of sh (at least for root) has been changed to match csh: Up and down arrows perform a history search matching on the first typed thing. This is literally the only reason that I haven’t already switched my root shells to sh: I generally run a tiny set of commands as root and the history search mode of csh is much nicer for that kind of use. In every other way, I prefer a POSIX-style shell and so bapt’s work here is giving me the best of both worlds.
Not entirely, reverse-search can do substring matching (at least in bash), this will search backwards for the prefix you’ve typed in before pressing up/down. So if you type “cat” followed by uparrow, it will go back in history to your last cat command, and then on in your cat command history.
I was generally not pleased with this behavior (coming from ctrl-r), but it’s quite nice after getting used to it.
This is the up-line-or-beginning-search / down-line-or-beginning-search widgets in Zsh, very nice. Although once I had that, whenever I was in the ctrl-r isearch mode I automatically started trying to do the same thing so had to bind to history-incremental-search-backward and history-incremental-search-forward in the isearch keymap for my shell to catch up to what my fingers automatically started doing.
For me, the most important part of this change is that the history behaviour of sh (at least for root) has been changed to match csh: Up and down arrows perform a history search matching on the first typed thing. This is literally the only reason that I haven’t already switched my root shells to sh: I generally run a tiny set of commands as root and the history search mode of csh is much nicer for that kind of use. In every other way, I prefer a POSIX-style shell and so bapt’s work here is giving me the best of both worlds.
Is that the same as the ctrl+r mode?
Not entirely, reverse-search can do substring matching (at least in bash), this will search backwards for the prefix you’ve typed in before pressing up/down. So if you type “cat” followed by uparrow, it will go back in history to your last cat command, and then on in your cat command history.
I was generally not pleased with this behavior (coming from ctrl-r), but it’s quite nice after getting used to it.
This is the
up-line-or-beginning-search
/down-line-or-beginning-search
widgets in Zsh, very nice. Although once I had that, whenever I was in the ctrl-r isearch mode I automatically started trying to do the same thing so had to bind tohistory-incremental-search-backward
andhistory-incremental-search-forward
in the isearch keymap for my shell to catch up to what my fingers automatically started doing.Oh God, I feel like csh was one of the reasons I gave up on FreeBSD one of the times I tried. Well done FreeBSD!
Do any shells have a POSIX mode where they reject all extensions? I used to assume
/bin/sh
would be portable; that hasn’t gone well.On Linux at least,
/bin/sh
should invoke/bin/bash
in POSIX compatibility mode.Isn’t that distro dependent? I think
/bin/sh
should be strictly POSIX. On Debian/Ubuntu it is dash.It is distro dependent.
One counter-example I’m aware of there: /bin/sh on Linux supports
local
which is not in POSIX.I say as someone who’s well versed with tcsh(1): I’m really happy about this.
(Weirdly, the most pushback I’ve ever had on this site was advocating for more POSIX, etc. Go figure!)