Shell脚本常用参数
来源:互联网 发布:python上传图片步骤 编辑:程序博客网 时间:2024/06/02 03:19
Shell脚本常用参数
比较两个字符串的关系:
1.if [ str1=str2 ];then fi ----当两个字符串相同时返回真2.if [ str1!=str2 ];then fi ----当两个字符串不相等时返回真3.if [ -n str1 ];then fi ----当字符串的长度大于0时返回真 (判断变量是否有值)4.if [ -z str1 ];then fi ----当字符串的长度为0时返回真
判断数字的关系:
1.int1 -eq int2 --相等2.int1 -ne int2 --不相等3.int1 -gt int2 --大于4.int1 -ge int2 --大于等于5.int1 -lt int2 --小于6.int1 -le int2 --小于等于
文件判断常用命令如下:
1. -r file --用户可读为真2. -w file --用户可写为真3. -x file --用户可执行为真4. -f file --文件存在且为正规文件为真5. -d file --如果是存在目录为真6. -c file --文件存在且为字符设备文件7. -b file --文件存在且为块设备文件8. -s file --文件大小为非0为真,可以判断文件是否为空9. -e file --如果文件存在为真
逻辑判断主要有下面三个命令:
1. -a --与2. -o --或3. ! --非
阅读全文
0 0
- Shell脚本常用参数
- 脚本学习-----常用shell脚本if参数
- shell脚本常用脚本
- Shell脚本中参数传递方法常用有8种
- shell 脚本 if 参数
- shell 脚本 if 参数
- shell脚本 if参数
- shell脚本文件参数
- shell脚本的参数
- Shell 脚本参数说明
- shell脚本文件参数
- shell脚本参数
- shell 脚本参数变量
- shell脚本参数
- 访问Shell脚本参数
- shell脚本参数
- shell 带参数脚本
- shell 脚本传入参数
- 稳定匹配问题(一)
- G
- LeetCode 572. Subtree of Another Tree
- SQL Server数据库之数据库的创建、修改、查看、删除及分离与附加
- 剑指offer第32题(把数组排成最小的数)
- Shell脚本常用参数
- java两年开发工作经验面试总结
- 线性表之离散存储(链表)
- Android多点触控技术
- Kotlin使用EasyRecycleview
- 陀螺仪初探
- Android解析编译之后的所有文件(so,dex,xml,arsc)格式
- javascript:void(0)
- 软件测试_单元测试