Change Profiles Shell settings in Terminal on Mac
Use Shell settings in Terminal to change the startup or exit behavior of the shell for a Terminal window profile.
To change these settings in the Terminal app on your Mac, choose Terminal > Settings, click Profiles, select a profile, then click Shell.
Note: The settings you choose in this pane apply only to the profile you select. They don’t apply to the Terminal app in general.
Set a command to run when the shell starts up.
When the shell exits
To change the way the window behaves when the shell exits, click the pop-up menu, then choose an option:
Ask before closing
Select whether to receive an alert before processes are terminated.