Pressing "UP" for command history in `sh` is partially broken (for a while)

Sometime around FreeBSD 14 (I think) the default shell was changed to `sh`. In early beta versions of 14.0 it worked as you'd expect. Type in a few letters of the command, press the UP key on your keyboard and it would cycle through the history and complete the rest of the command with anything that started with those letters. Even just one or two letters.

Then when the final version was released that behavior broke. It became less reliable. No longer could you just type just one or two chars, and sometimes pressing up would do absolutely nothing of value except show you any command unrelated to what you typed in. It's been liked that ever since.

This was feature in csh, and it was one of (if not the reason) I fell in love with FreeBSD.

Why has it been broken for some long? How would I even fill a bug report for this?
 
Well if you change your shell back to csh it works again. It's just not a feature of sh.

edit: it seems sh has that feature too nowadays.
 
For me it does the job, mostly I would say, because I agree the feature is not as reliable as it is in other shell, a bit buggy sometimes but overall it works, maybe try with at least 3 letters instead of 2.
Also check your history file just to be sure that what you seek is indeed there.

Since that feature has been imported the shell feels more comfortable for my FreeBSD VMs. If I have to keep the VM around a bit longer then zsh will be installed no doubt, but for a quick test then the modern sh is good enough.
 
People say that [t]csh is the default shell, but it's only the default for root, the default in adduser is sh. Has the default for root really changed? Are you sure you aren't mixing-up the two cases?
 
Back
Top