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"
Linux shell 内部变量的更多相关文章
- Linux SHELL,环境变量
SHELL: 在计算机科学中,Shell俗称壳(用来区别于核),是指"提供使用者使用界面"的软件(命令解析器).它类似于DOS下的command和后来的cmd.exe.它接收用户命 ...
- Linux Shell 高级变量及字符串
高级变量包含三个部分1.变量扩展2.命令替换3.算术扩展在Bash Shell中,$算符会触发到上述三种扩展,基本形式如下: 基本型 扩展种类 例子 ...
- Linux shell 内部命令与外部命令有什么区别以及怎么辨别
内部命令实际上是shell程序的一部分,其中包含的是一些比较简单的linux系统命令,这些命令由shell程序识别并在shell程序内部完成运行,通常在linux系统加载运行时shell就被加载并驻留 ...
- shell内部变量
linux中shell变量$#,$@,$0,$1,$2的含义解释: 变量说明: $$ Shell本身的PID(ProcessID) $! Shell最后运行的后台Process的PID $? 最后运行 ...
- Linux shell 环境变量及有效范围
每当我们使用ssh客户端远程登陆一个服务时,操作系统就会给我们分配一个新的shell,并且这个shell继承了操作系统的永久环境变量.在当前的shell执行一个sh文件,都会临时产生一个子shell, ...
- Linux Shell编程变量赋值和引用
我们可以使用任意一种文字编辑器,比如gedit.kedit.emacs.vi等来编写shell脚本,它必须以如下行开始(必须放在文件的第一行): #!/bin/sh ... 注意:最好使用“! ...
- linux shell $ 特殊变量
$0 #Shell本身的文件名 $1-$n #添加到Shell的各参数值.$1是第1参数.$2是第2参数… $* #所有参数列表.如"$*"用「"」括起来的情 ...
- 8. LINUX shell 环境变量
wc –l file 计算文件行数, wc -w file 计算文件中的单词数, wc -c file 计算文件中的字符数 查看文件内容: cat .more
- 【Linux】Shell三类变量的作用域——linux shell “永久环境变量”、“临时环境变量”和"普通变量"之完全解读
2015-05-08 00:15 3896人阅读 评论(10) 收藏 举报 本文章已收录于: 分类: 软件开发进阶(419) 作者同类文章X Unix/Linux杂项(118) 作者同类文章X ...
随机推荐
- vue 阿里云上传组件
vue 阿里云上传组件 Vue.js上传图片到阿里云OSS存储 测试项目git地址 本测试项目启动方法 示例链接 组件配置项 实践解释 本文主要介绍如何 在vue项目中使用web 直传方式上传阿里云o ...
- Unity WWW类调用http
1.Http请求中Content-Type讲解 MediaType,即是Internet Media Type,互联网媒体类型:也叫做MIME类型,在Http协议消息头中,使用Content-Type ...
- 【转】工具系列:IntelliJ IDEA (Mac) 运行速度优化
转自工具系列:IntelliJ IDEA (Mac) 运行速度优化 感谢该作者解决了我使用idea debug很慢的问题 背景 IDEA 下运行程序,经常假死 5 s,作为 Mac 怎么能允许暂停 5 ...
- spring-boot-maven-plugin 插件的作用(转)
OM 文件中添加了“org.springframework.boot:spring-boot-maven-plugin”插件.在添加了该插件之后,当运行“mvn package”进行打包时,会打包成一 ...
- Hibernate中的HQL
一.查询所有的时候 List<Company> list=session.createQuery("from Company as c order by c.cid desc&q ...
- leetcode题解||ZigZag Conversion问题
problem: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of r ...
- hpc-ai比赛相关资料
http://follitude.com/blog/Use-RDMA-Emulation-in-Software-Using-SoftiWARP/ https://www.reflectionsoft ...
- 通过setInterval函数在地图上每隔1s打一次点
<?php echo <<<_END <!doctype html> <html> <head> <meta charset=&quo ...
- HD-ACM算法专攻系列(7)——Text Reverse
问题描述: 源码: /**/ #include"iostream" #include"string" using namespace std; void Pri ...
- (转)js document.all的用法
document.all用法 一. document.all是页面内所有元素的一个集合.例如: document.all(0)表示页面内第一个元素 二.document.all可以判断浏览器 ...