Linux – want user will logout from shell on exit of bash script

bashlinuxshell-scripting

I want, when a linux user exits from a shell script, that it also logs out from the bash shell.
Is this possible?

Best Answer

Instead of starting the script normally, exec it instead. This will replace the login shell, so when the script finishes the user will be logged out.