Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jan 2020 20:35:42 +0100
From:      Polytropon <freebsd@edvax.de>
To:        byrnejb@harte-lyne.ca
Cc:        "James B. Byrne via freebsd-questions" <freebsd-questions@freebsd.org>
Subject:   Re: /bin/sh save history
Message-ID:  <20200110203542.8022d7c3.freebsd@edvax.de>
In-Reply-To: <0dbba1cf7eeb52e8f398d61434eaceb4.squirrel@webmail.harte-lyne.ca>
References:  <0dbba1cf7eeb52e8f398d61434eaceb4.squirrel@webmail.harte-lyne.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200110203542.8022d7c3.freebsd>