问题
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
?
回答1:
Instead of sourcing a specific file, you define an event handler that runs when the shell exists.
From 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
回答2:
You may follow @chepner 's answer.
But, you can also override exit
and logout
function instead of a event listener!
function exit
echo exiting...
kill %self
end
Do the same to
logout
And, it works
来源:https://stackoverflow.com/questions/39728790/bash-equivalent-bash-logout-for-fish-shell