/bin/sh save history

Polytropon freebsd at edvax.de
Fri Jan 10 19:35:52 UTC 2020


On Fri, 10 Jan 2020 10:23:45 -0500, James B. Byrne via freebsd-questions wrote:
> Is there no way to specify a history file for /bin/sh and
> automatically save / merge the session hitory with that of previous
> and concurrent sessions?

According to "man sh", this isn't supported by the shell.
However, /bin/sh never really was intended for interactive
use - it's FreeBSD's default _scripting_ shell, and, per
preconfiguration, the emergency shell you get in single
user mode (which typically doesn't stop you to launch a
more user-friendly shell in case there's more interaction
ahead).



> I have searched the man page and done the online thing but cannot seem
> to find any reference to a means to save the session history of
> /bin/sh.  Is it just not possible?

Doesn't seem to be possible, but re-check with "man sh".
Of course the C shell (tcsh in FreeBSD), FreeBSD's default
interactive shell, does have this feature which you can
control with ~/.cshrc:

	set history = 200000
	set savehist = (200000 merge)

It will maintain a ~/.history file.

Now of course is the time to remind you that there are
shells better suited for interactive use, such as bash
or zsh, but as a long-time C shell user I won't mention
anything else. ;-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list