I want, when a linux user exits from a shell script, that it also logs out from the bash shell.
Is this possible?
Linux – want user will logout from shell on exit of bash script
bashlinuxshell-scripting
Related Topic
- Difference Between Double and Single Square Brackets in Bash – Scripting Shell POSIX
- Linux – How to run a command multiple times, using bash shell
- Linux – How to run command as user who has /usr/sbin/nologin as Shell
- Bash – Run an interactive bash subshell with initial commands without returning to the (“super”) shell immediately
- Linux – bash : “set -e” and check if a user exists make script exit
- Linux – Access windows file system from linux shell script
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.