You can use the exec
command to replace one interactive shell with another. From man bash
for example (where exec
is provided as a shell builtin command)
exec [-cl] [-a name] [command [arguments]] If command is specified, it replaces the shell. No new process is created.
What happens after that depends: if the original shell was a login shell, then the session will terminate. If the shell is an interactive shell running in a terminal emulator for example, then the terminal emulator application decides what to do: for gnome-terminal
you have a choice under the Edit
-> Preferences
menu between closing the terminal, not closing the terminal (leaving it rather useless - without a shell) or relaunching the default shell.