When I run terminal within Pathfinder, typing exit is just a mistake (blocks the Window for nothing).
How may I
- Figure out I'm in Pathfinder
- Suppress
exitin Zshell if I am in Pathfinder?
When I run terminal within Pathfinder, typing exit is just a mistake (blocks the Window for nothing).
How may I
exit in Zshell if I am in Pathfinder?exit is a built-in of zsh. The easiest way to disable it - or any other command - is to create an alias with the same name that does nothing:
alias exit=
or maybe prints a short message to be a bit more informative:
alias exit='echo "Sorry, but I cannot do that."'
To run this automatically for shell sessions inside Pathfinder, set it in the "Run command" field in Pathfinder's settings.
Note: an alias is always scoped to the session of zsh in which it was defined. It will not carry over to any other zsh session you start from there, so exit will still work normally these other sessions. Also, aliases set in a child session of zsh will not carry over to the parent session.
That also means that you cannot just run a script to set aliases or make any other changes to the current shell environment. But you can use the source command to execute commands from a script in the current shell session.
Instead of setting alias exit= in "Run command" you can then set the following (as noted in a comment by the OP):
source /path/to/some/script_with_settings
with /path/to/some/script_with_settings containing:
alias exit=
possibly among other things.