1. 39
  1.  

  2. 13

    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.

    1. 3

      Is that the same as the ctrl+r mode?

      1. 4

        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.

        1. 3

          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.

    2. 7

      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!

      1. 4

        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.

        1. 1

          On Linux at least, /bin/sh should invoke /bin/bash in POSIX compatibility mode.

          1. 5

            Isn’t that distro dependent? I think /bin/sh should be strictly POSIX. On Debian/Ubuntu it is dash.

            1. 5

              It is distro dependent.

            2. 2

              One counter-example I’m aware of there: /bin/sh on Linux supports local which is not in POSIX.

          2. 3

            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!)