Lauching a Terminal '.command' file, without exiting session

Solution 1:

As the final step in your script you can make it run a shell for you - just put the shell as the final line, eg. bash, or zsh.

That'll then drop you into the Terminal, within the script, and you'll get access to it's environment too.

However, that'll also stop your scripts from running to completion if you're not running them interactively. You could test for that and handle it as part of your script. Do it often enough and it might be worth making a shell function for it and sourcing it in from a standard location.

Or, since what you seem to want is just an easy way to run scripts, you can setup a bunch of aliases for them in your shell rc file (.zshrc or .bashrc), and have them available to call when you want them. That way you'll still be able to continue your work, and it's easy to re-run the script too - just run the alias again.