Macos – How to execute a shell script without exit? (Mac OS X)

exitmacosshell-scriptterminal

I'm making a shortcut icon on my Dock which opens a terminal window with some preconfigured environment variables. I made a script and dragged it into my Dock. It runs well, however it exits immediately when it completed. I want to start console work with preconfigured variables. How can I make it does not exit after script execution complete?

Best Answer

You can put

read -p "Press Return to Close..."

as the last line of the script. That will keep it up until you hit enter.

Re: your edit

If you invoke bash (or whatever shell you use) as the last line of the script it should (as in does for me on Linux) stay open with a prompt.

Related Question