在$HOME/.profile
环境变量中ENV
设置为$HOME/.shrc
并通过 定义export ENV
。我的外壳echo $0
是-sh
.
在$HOME/.shrc
我声明变量 HISTFILE 和 HISTSIZE 中:
HISTFILE=$HOME/.sh_history
HISTSIZE=500
export HISTFILE
export HISTSIZE
但重启后就没有可用的历史记录了。
编辑:
历史
A sh command, the Thompson shell, appeared in Version 1 AT&T UNIX. It was superseded in Version 7 AT&T UNIX by the Bourne shell, which inher- ited the name sh. This version of sh was rewritten in 1989 under the BSD license after the Bourne shell from AT&T System V Release 4 UNIX.
作者
This version of sh was originally written by Kenneth Almquist.
答案1
root 帐户默认使用 tcsh,它采用“history”别名/命令;而除非另有说明,否则 sh 是用户的默认值。 sh 的历史命令的实际二进制文件是:
/usr/bin/fc
与-l
旗帜,即fc -l
还看man history