我想启动一个带有预定义历史文件的 Gnome 终端窗口。
我试过:
gnome-terminal -e 'bash -c "history -c; history -r ~/test.hist; exec bash"'
但它仍然使用标准历史文件:~/.bash_history
..
答案1
使用变量设置历史文件HISTFILE
。从man bash
:
HISTFILE
The name of the file in which command history is saved (see
HISTORY below). The default value is ~/.bash_history. If
unset, the command history is not saved when a shell exits.
你可以试试:
gnome-terminal -e 'bash -c "export HISTFILE=~/test.hist; exec bash"'