为什么root用户不能回调命令呢,而普通用户却可以
# id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7(lp),20(users)
# env
_=/usr/bin/env
MANPATH=/usr/share/man/%L:/usr/share/man:/usr/contrib/man/%L:/usr/contrib/man:/usr/local/man/%L:/usr/local/man:/opt/mx/share/man:/opt/upgrade/share/man/%L:/opt/upgrade/share/man:/opt/pd/share/man/%L:/opt/pd/share/man:/opt/pd/share/man/%L:/opt/pd/share/man:/opt/pd/share/man/%L:/opt/pd/share/man:/opt/resmon/share/man:/opt/hparray/share/man/%L:/opt/hparray/share/man:/opt/graphics/common/man:/usr/dt/share/man:/opt/samba/man:/opt/gnome/man:/opt/ignite/share/man/%L:/opt/ignite/share/man:/opt/perf/man/%L:/opt/perf/man
PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/upgrade/bin:/opt/fcms/bin:/opt/pd/bin:/opt/resmon/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/graphics/common/bin:/opt/gnome/bin:/opt/mozilla:/opt/mx/bin:/usr/sbin/diag/contrib:/opt/perf/bin:/sbin:/home/root
COLUMNS=125
EDITOR=/usr/bin/vi
LOGNAME=root
MAIL=/var/mail/root
ERASE=^H
SHELL=/sbin/sh
HOME=/
TERM=vt100
PWD=/
TZ=EAT-8
LINES=35
-----------------------------------------------------------------------
/home/test$id
uid=103(test) gid=20(users)
/home/test$env
_=/usr/bin/env
MANPATH=/usr/share/man/%L:/usr/share/man:/usr/contrib/man/%L:/usr/contrib/man:/usr/local/man/%L:/usr/local/man:/opt/mx/share/man:/opt/upgrade/share/man/%L:/opt/upgrade/share/man:/opt/pd/share/man/%L:/opt/pd/share/man:/opt/pd/share/man/%L:/opt/pd/share/man:/opt/pd/share/man/%L:/opt/pd/share/man:/opt/resmon/share/man:/opt/hparray/share/man/%L:/opt/hparray/share/man:/opt/graphics/common/man:/usr/dt/share/man:/opt/samba/man:/opt/gnome/man:/opt/ignite/share/man/%L:/opt/ignite/share/man:/opt/perf/man/%L:/opt/perf/man
PATH=/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/upgrade/bin:/opt/fcms/bin:/opt/pd/bin:/opt/resmon/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/graphics/common/bin:/opt/gnome/bin:/opt/mozilla:/opt/mx/bin:/usr/sbin/diag/contrib:/opt/perf/bin
COLUMNS=125
EDITOR=usr/bin/vi
LOGNAME=test
MAIL=/var/mail/test
ERASE=^H
PS1=$PWD$
SHELL=/sbin/sh
HOME=/home/test
TERM=vt100
PWD=/home/test
TZ=EAT-8
LINES=35
/home/test$
-------------------------------------------------------------
# uname -a
HP-UX rp5470 B.11.11 U 9000/800 555706587 unlimited-user license
用test用户按'ESC'后可以使用vi模式,例如,按'k'可以回调刚才输入的命令,
在用root用户按'ESC'后再按'i'可以输入,但按'ESC'后再按'k'或'j'则不行,谁知道是什么原因呢
不知道我说的够不够清楚
[ 本帖最后由 qingzhi76 于 2009-6-12 15:14 编辑 ]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
把set -o vi 去掉,换成下面三行,缺一不可
export EDITOR=vi
export HISTSIZE=50
export HISTFILE=~/.sh_history
-----------------------------------------------
或者不要这三行,直接一句set -o vi,好像也行的,你试试吧
一般用户的.profile里我也有加如下:
export HISTFILE=$HOME/.sh_history
export HISTSIZE=1000
权限都是用户自己的权限,没改动。
结果是:我可以用history -50看到以前输入过的命令,但是我用esc+k就是没反应,而且,2下ESC也没法补全命令
一般用户的profile是怎么写的?
其.sh_history存在吗?权限是什么?
我遇到有些机器是ROOT可以调历史命令,而一般用户却不可以。/etc/profile和用户主目录下的环境变量都已设置好。
不知道大家有何高见?
在用户的.profile里,或者在/etc/profile里
加上下面的
export HISTFILE=#HOME/.sh_history
set -o vi
就可以了.
或者,可以再加上
export HISTSIZE=500
另外,只要加了上面两句,/sbin/sh也可以支持的.
[ 本帖最后由 tianxiay2ren 于 2009-6-15 17:29 编辑 ]
多说两句很难吗
?
SHELL=/sbin/sh
这个shell不支持
啥问题?
root的shell不支持这样搞吧
已解决