shell test判断命令
判断命令test
使用test命令可以对文件,字符串等进行测试,一般配合控制语句使用,如while,if,case
"字符串测试"
test str1==str2 测试字符串是否相等
test str1!-str2 测试字符串是否不相等
test str1 测试字符串是否不为空
test -n str1 测试字符串是否不为空
test -z str1 测试字符串是否为空
"int 测试"
test int1 -eq int2 测试整数是否相等
test int1 -ne int2 测试整数是否不相等
test int1 -ge int2 测试整数int1是否>=int2
test int1 -gt int2 测试整数int1是否>int2
test int1 -le int2 测试整数int1是否<=int2
test int1 -lt int2 测试整数int1是否<int2
"文件测试"
test -d file 指定文件是否目录
test -f file 指定文件是否常规文件
test -x file 指定文件是否可执行
test -r file 指定文件是否可读
test -w file 指定文件是否可写
shell test判断命令的更多相关文章
- shell条件判断命令test
- 在Shell里面判断字符串是否为空
在Shell里面判断字符串是否为空 分类: Linux shell2011-12-28 23:18 15371人阅读 评论(0) 收藏 举报 shell 主要有以下几种方法: echo “$str” ...
- shell 脚本——判断条件
在之前的shell语言学习笔记中已经写过shell的几种判断语句及循环语句,也简单的介绍了shell语言判断语句和判断条件.在此再做进一步学习. test命令的测试功能 test命令用于检测系统文件及 ...
- shell基础--test命令的使用
test :用于文件类型检查和变量比较 一.用途: 1.判断表达式 2.判断字符串 3.判断整数 4.判断文件 测试例子: (1).test [root@~_~ day5]# cat test.sh ...
- shell if判断中常用的a-z表达式含义
shell if判断中常用的a-z表达式含义 可通过在在linux中man test命令查看下列参数的详细用法 [ -a FILE ] 如果 FILE 存在则为真. [ -b FILE ] 如果 ...
- Linux Shell编程 test命令
概述 test 命令是Shell 脚本中用来进行条件判断的. test命令示例 按照文件类型进行判断 测试选项 作 用 -b 文件 判断该文件是否存在,并且是否为块设备文件(是块设备文件为真) -c ...
- (转)shell中test命令方法详解
test命令用法.功能:检查文件和比较值 shell中test命令方法详解 原文:https://www.cnblogs.com/guanyf/p/7553940.html 1)判断表达式 if te ...
- Shell之Test命令
目录 Shell之Test命令 参考 Test简介 Test语法 表达式之逻辑运算 表达式之字符串判断 表达式之整数判断 表达式之文件判断 Shell之Test命令
- 判断命令test
判断命令test一般用于脚本当中,可以简写为中括号[ ].其会对跟随的条件进行判断,一般可以分为数值判断.字符串判断和文件判断.语法格式为test [判断条件]或[ 判断条件 ],注意中括号[ ]与判 ...
随机推荐
- oracle 存储过程给另一个用户的权限问题
grant execute on (包名)存储过程名称 to 用户名; grant debug on (包名)存储过程名称 to 用户名 grant select on 存储过程名称 to 用户名 ...
- Pg MySQL
https://blog.csdn.net/tiandao2009/article/details/79839037 1架构 2对sql支持的完备性 3join Nest join , 4表分区 p ...
- OpenModelica读取文件
parameter String file = Modelica.Utilities.Files.loadResource("J:/git/tcs/tcs.txt"); 将文件名变 ...
- tensorflow学习笔记一------下载安装,配置环境(基于ubuntu16.04 pycharm)
一,安装TensorFlow 安装所有必备工具 sudo apt-get install python-pip python-dev python-virtualenv 安装TensorFlow su ...
- 在vscode中,自定义代码片段,例vue组件的模板
1---- 2---- 输入vue, 选 vue.json 3---- 在vue.json中编辑, 有说明 a. tab符,要用空格, 也可以转义 4---- 新建vue文件, 输入自定义 ...
- Transactional cannot be resolved to a type
SpringBoot整合Mybatis时遇到“ Transactional cannot be resolved to a type ” ,以为是没有导入相应的包 “ import org.sprin ...
- datagrid数据表格当数据为0的时候页面不显示数据
如下图: datagrid数据表格当数据为0的时候页面不显示数据,为空的表格数据全是0,但是页面无法显示 传递的json数据也是没问题的: 所以实在想不通,为什么easyUI datagrid 不显示 ...
- VMware安装Linux并配置网络通信
说明: Linux系统:CentOS-6.8-x86_64-minimal.iso VMware版本:9.0 首先下载VMware并安装.然后将CentOS-6.8-x86_64-minimal.is ...
- PHP添加Memcached扩展
1.下载memcached扩展 https://pecl.php.net/package/memcache 2.tar -xzvf memcache-2.2.7.tgz #解压memcached ...
- 京东某商品页面的简单爬取 --Pyhon网络爬虫与信息获取
1.京东商品页面链接地址(本次要爬取的页面url) https://item.jd.hk/1953999200.html 2.代码部分 import requestsurl = "https ...