Bash等效于.bash_logout的FISH shell [英] Bash equivalent .bash_logout for FISH shell
问题描述
通常,我在 .bash_logout
中为 bash
shell编写退出脚本。我最近开始使用 fish
shell。相当于 fish
的 .bashrc
位于〜/ .config / fish / config中。鱼
,但是在哪里找到 .bash_logout
的等价物?
Generally I write my exit scripts for bash
shell in .bash_logout
. I recently started using fish
shell. The .bashrc
equivalent of fish
is located in ~/.config/fish/config.fish
but where do I find the equivalent for .bash_logout
?
推荐答案
您无需定义特定文件,而是定义了一个事件处理程序,该事件处理程序在外壳程序存在时运行。
Instead of sourcing a specific file, you define an event handler that runs when the shell exists.
来自 http://fishshell.com/docs/current/index.html#initialization :
如果要在鱼退出时运行一组命令,请使用由外壳退出触发的事件处理程序:
If you want to run a set of commands when fish exits, use an event handler that is triggered by the exit of the shell:
function on_exit --on-process %self
echo fish is now exiting
end
这篇关于Bash等效于.bash_logout的FISH shell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!