A classic use of read-only variables is with TMOUT
. Setting this variable to a non-zero value will logout an interactive terminal session after TMOUT
seconds of inactivity (i.e. no keyboard input). To defeat a smart user from overriding the setting, use readonly
:
readonly TMOUT=60
Having done this, there is no way to do:
export TMOUT=0