Stop `exit` from running

Dan Rosenstark

When I run terminal within Pathfinder, typing exit is just a mistake (blocks the Window for nothing).

How may I

  1. Figure out I'm in Pathfinder
  2. Suppress exit in Zshell if I am in Pathfinder?
Adaephon

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

stop testing from running mocha

From Dev

stop testing from running mocha

From Dev

stop adb logcat from running

From Dev

FULLY stop an antivirus from running

From Dev

How to stop a for loop from running?

From Dev

stop program from exit/termination until user types exit

From Dev

Exit from bash script but keep the process running

From Dev

Exit from script by running another script instead

From Dev

Exit from bash script but keep the process running

From Dev

How to stop Intellij from automatically running SBT

From Java

How to stop/terminate a python script from running?

From Dev

How to just stop a method from running?

From Dev

Really stop Apache 2.4 from running on Yosemite

From Dev

Is it possible to stop a certain thread from running?

From Dev

How to stop a running app from command line

From Dev

stop task from running when file is open

From Dev

How to stop mysql from running at boot time?

From Dev

Is there a way to stop Java from continually running in background?

From Dev

how to stop matlab from running a script in mac

From Dev

How to stop android studio from running

From Dev

How to stop code from running on a specific date

From Dev

How to stop Cortana from running in the background?

From Dev

Stop a function from running on hover of element

From Dev

How to stop a c++ code from running

From Dev

Stop a function from running in javascript, if a div is empty

From Dev

Stop systemd service from running at boot

From Dev

How to stop bash scripts from exit ing the window altogether

From Dev

How to stop this command from exit-ing the terminal

From Dev

keep ROR app running even on exit from shell

Related Related

HotTag

Archive