Shell – History in the Almquist shell in the NetBSD

ashcommand historynetbsdshell

In NetBSD /bin/sh is a modified version of the Almquist shell. With the command fc -l it is possible to view the last 16 commands typed in the prompt in the current session and not the older ones.

The environment variable HISTSIZE is set at 1000 and in bash this means that the last 1000 commands (whether or not they were typed in the current session) are saved in a file named .bash_history in the home directory. But here it seems to mean just that the last 1000 commands in this session are keeped in the history, and the history does not seem to be saved in a file.

I am looking for a history which allows not only to read the last commands of the current session, but also the commands of the previous sessions (for example, the previous time I started the system, not the actual time). Does /bin/sh in NetBSD have by default such an history? If not, is it possible to create such an history in that shell?

Best Answer

I don't really understand your question, what's the actual question?

First you are stating that you can access the history via the fc builtin and then you are asking if the shell implements a history?

Furthermore, the man page states:

The number of previous commands that can be accessed are determined by the value of the HISTSIZE variable.

and

A login shell first reads commands from the files /etc/profile and .profile if they exist. If the environment variable ENV is set on entry to a shell, or is set in the .profile of a login shell, the shell next reads commands from the file named in ENV. Therefore, a user should place commands that are to be executed only at login time in the .profile file, and commands that are executed for every shell inside the ENV file. To set the ENV vari- able to some file, place the following line in your .profile of your home directory

      ENV=$HOME/.shinit; export ENV

substituting for .shinit any filename you wish.

If your question is whether history gets written to a file, it does not seem to be the case.

Related Question