Linux怎么实现自动填充内容到命令提示符
1. 运行环境
centos7
2. 问题描述?
~/.bashrc中添加了函数rhist,其中的$result是由历史命令查询工具rhist返回的。
现在是$result添加到了历史记录中了,但要手动用上方向键调出来。我想的是把$result自动填充到命令提示符上去,等待编辑或者执行。
rhist() {
local result=$(command rhist "$@")
[ -n "$result" ] && echo "$result" && echo "$result" >> ~/.bash_history && history -r
}
现在是:
[root@VM-4-8-centos ~]# rhist
结果内容
[root@VM-4-8-centos ~]#
期望的结果是:
[root@VM-4-8-centos ~]# rhist
[root@VM-4-8-centos ~]# 结果内容
推荐文章: