Linux shell 内部变量
1 TMOUT
来自bash的解释: 
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. 
能够了解TMOUT能够非常好的read命令结合,在用户长时间没有输入时,能够通过TMOUT指定的时间来结束read的运行. 
实例:
#!/bin/bash
TMOUT=4
echo -e "plesae input your name:"
read name
if [ -z $name ]
then
    name="(no name provide)"
fi
echo "Your name is : $name"
posted on 2017-06-20 19:10 cynchanpin 阅读(189) 评论(0) 收藏 举报
                    
                
                
            
        
浙公网安备 33010602011771号