history

Polytropon freebsd at edvax.de
Fri Sep 20 04:55:13 UTC 2013


On Thu, 19 Sep 2013 19:36:43 +0000, william benton wrote:
> when I log into free bsd I am in the sh shell. i type history
> at the command line and the machine says history not found.
> If I type h at the command line it works like i expect the
> history command to work.

That is strange. The sh shell (system scripting shell and
emergency dialog shell in SUM) does not have a history function.

	% sh
	$ h
	h: not found
	$ history
	history: not found
	$ _



> In the csh or tcsh shells history works as well as h.

This is correct. A system-wide alias is defined for those shells:

	alias	h	'history 25'

It can be found in /etc/csh.cshrc.



> why does entering history at the command line work in the csh and
> tcsh  shells  but not in the sh shell.

The sh shell (Bourne-like shell, actually a derivate of ash) does
not have this functionality. Bash, the Bourne-again shell, supports
the "history" function internally, and a "h" alias can be defined
for this shell.

	% bash
	$ history
	[...]
	  501  history
	$ _



> Considering that all three shells seem to have the same .cshrc file?

They don't. The csh and tcsh (system default dialog shell) use the
cshrc mechanism (/etc/csh.cshrc for global settings, .cshrc for user
settings, and .login and .logout for interactive shells), while sh
uses /etc/profile and .profile and .shrc similarly. Bash uses .profile
as well as .bash_profile and .bash_login in a comparable manner.



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


More information about the freebsd-questions mailing list