1828227 Members
3370 Online
109975 Solutions
New Discussion

about TMOUT

 
SOLVED
Go to solution
juno2
Super Advisor

about TMOUT

I know there is a TMOUT function in unix (ksh) , is there the same function in bash? thx.
2 REPLIES 2
Stuart Browne
Honored Contributor
Solution

Re: about TMOUT

'man bash' shows:

+++
TMOUT
If set to a value greater than zero, TMOUT is treated as the default timeout for the read builtin. The select command terminates if input does not arrive after TMOUT seconds when input is coming from a terminal. In an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt. Bash terminates after waiting for that number of seconds if input does not arrive.
+++

Simply put, if the number is bigger than 0, and you leave the shell at a prompt for longer than that value, it closes the shell (logs out).

This appears to have the exact same functionality as the same variable in KSH.
One long-haired git at your service...
Michael Steele_2
Honored Contributor

Re: about TMOUT

From either $HOME/.bash_profile or /etc/bashrc for all:

export TMOUT=0
export TMOUT=3600 (* 1 hour *)
export TMOUT=1800 (* 30 minutes *)
export TMOUT=60 (* 1 minute *)
etc.
Support Fatherhood - Stop Family Law