read only TMOUT variable – workaround to disable automatically exit shell when there is no activity

Add this to the start of your .bash_profile ?

if [ ! -z "$TMOUT" ]; then
  env -i bash --init-file ~/.bash_profile
fi

Beware the wrath of the sysadmins if you leave a gazillion old sessions running as a result of defeating their timeout rulings.


You can issue perl commands from the command line...

perl -e '$|++; while (1) { print "\e[0n"; sleep 120; }'

or you could do the same in shell (a sh/bash example):

while sleep 120; do printf '\33[0n'; done

Or you could use watch:

watch -n 120 printf '\33[0n'


Here is the thing,
When the session variable is "Read Only" you have to replace the current shell process with the command by "exec"
So, the Answer to your question is:

$> exec env TMOUT=0 bash

But I recommend setting a higher timeout value

$> exec env TMOUT=3600 bash