-s file     文件大小非0时为真
[ -f "somefile" ] :判断是否是一个文件

[ -x "/bin/ls" ] :判断/bin/ls是否存在并有可执行权限

[ -n "$var" ] :判断$var变量是否有值

[ "$a" = "$b" ] :判断$a和$b是否相等

-r file     用户可读为真

-w file     用户可写为真

-x file     用户可执行为真

-f file     文件为正规文件为真

-d file     文件为目录为真

-c file     文件为字符特殊文件为真

-b file     文件为块特殊文件为真

-s file     文件大小非0时为真    -s file true if the file has nonzero size

-t file     当文件描述符(默认为1)指定的设备为终端时为真

-a file exists.
-b file exists and is a block special file.
-c file exists and is a character special file.
-d file exists and is a directory.
-e file exists (just the same as -a).
-f file exists and is a regular file.
-g file exists and has its setgid(2) bit set.
-G file exists and has the same group ID as this process.
-k file exists and has its sticky bit set.
-L file exists and is a symbolic link.
-n string length is not zero.
-o Named option is set on.
-O file exists and is owned by the user ID of this process.
-p file exists and is a first in, first out (FIFO) special file or
named pipe.
-r file exists and is readable by the current process.
-s file exists and has a size greater than zero.
-S file exists and is a socket.
-t file descriptor number fildes is open and associated with a
terminal device.
-u file exists and has its setuid(2) bit set.
-w file exists and is writable by the current process.
-x file exists and is executable by the current process.
-z string length is zero.

shell脚本中 if 判断时候-s是什么意思的更多相关文章

  1. Shell脚本中判断输入参数个数的方法投稿:junjie 字体:[增加 减小] 类型:转载

    Shell脚本中判断输入参数个数的方法 投稿:junjie 字体:[增加 减小] 类型:转载   这篇文章主要介绍了Shell脚本中判断输入参数个数的方法,使用内置变量$#即可实现判断输入了多少个参数 ...

  2. Shell脚本中的逻辑判断、文件目录属性判断、if的特殊用法、case判断

    1.Shell脚本中的逻辑判断 格式1:if 条件 ; then 语句; fi格式2:if 条件; then 语句; else 语句; fi格式3:if …; then … ;elif …; then ...

  3. shell脚本中判断上一个命令是否执行成功

    shell脚本中判断上一个命令是否执行成功 shell中使用符号“$?”来显示上一条命令执行的返回值,如果为0则代表执行成功,其他表示失败.结合if-else语句实现判断上一个命令是否执行成功. 示例 ...

  4. centos shell脚本编程2 if 判断 case判断 shell脚本中的循环 for while shell中的函数 break continue test 命令 第三十六节课

    centos  shell脚本编程2 if 判断  case判断   shell脚本中的循环  for   while   shell中的函数  break  continue  test 命令   ...

  5. shell脚本中的逻辑判断、文件目录属性判断、if特殊用法、case判断

    7月12日任务 20.5 shell脚本中的逻辑判断20.6 文件目录属性判断20.7 if特殊用法20.8/20.9 case判断 20.5 shell脚本中的逻辑判断 逻辑判断在shell中随处可 ...

  6. [shell]上一个命令执行完成,才执行下一个操作 | shell脚本中判断上一个命令是否执行成功

    shell脚本中判断上一个命令是否执行成功  shell中使用符号“$?”来显示上一条命令执行的返回值,如果为0则代表执行成功,其他表示失败.结合if-else语句实现判断上一个命令是否执行成功. 场 ...

  7. Shell脚本中判断输入变量或者参数是否为空的方法

    shell判断一个变量是否为空方法总结 https://www.jb51.net/article/154835.htm 1.判断变量 复制代码代码如下: read -p "input a w ...

  8. Linux centosVMware shell脚本中的逻辑判断、文件目录属性判断、if特殊用法、case判断

    一.shell脚本中的逻辑判断 格式1:if 条件 ; then 语句; fi 格式2:if 条件; then 语句; else 语句; fi 格式3:if …; then … ;elif …; th ...

  9. 在shell脚本中使用函数

    转载请标明:http://www.cnblogs.com/winifred-tang94/ 对于在脚本中重复使用的功能模块,可以封装成为函数. shell脚本中函数的定义可以使用如下两种方式: a. ...

随机推荐

  1. post请求参数问题

    from:https://www.cnblogs.com/btgyoyo/p/6141480.html jQuery的ajax方法和post方法分别发送请求,在后台Servlet进行处理时结果是不一样 ...

  2. NUC972 linux 烧录

    节介绍如何刻录uboot.kernel和文件系统到NAND Flash, 并且设定NUC970系列芯片从NAND Flash中开机.本节操作需要windows环境下进行.(初次连接电脑需要安装驱动) ...

  3. 用 SQLite 和 FMDB 替代 Core Data

    本文转载至 http://blog.csdn.net/majiakun1/article/details/38680147 为什么我不使用Core Data Mike Ash 写到: 就个人而言,我不 ...

  4. HashSet TreeSet

    1 HashSet 1.1 父类 java.lang.Object 继承者 java.util.AbstractCollection<E> 继承者 java.util.AbstractSe ...

  5. centos 7 删除yum安装的openjdk

    # java -version # rpm -qa | grep java rpm -e --nodeps (rpm -qa的结果们) # java -version

  6. Smarty模板保留缓存

    <?php //缓存 //注:使用缓存需要用到这几个方法: //(ob_start(开启内存缓存); ob_flush(清除内存缓存);) //file_exists这个方法是判断文件是否存在 ...

  7. uni-app,wex5,APPcan,ApiCloud几款国内webapp开发框架的选型对比

    框架列表. https://www.cnblogs.com/xiaxiaxia/articles/5705557.html 前言 近期,要开一个新的项目,APP类型.最重要的需求就是能够随时调整APP ...

  8. Django----djagorest-framwork源码剖析

    restful(表者征状态转移,面向资源编程)------------------------------------------->约定 从资源的角度审视整个网络,将分布在网络中某个节点的资源 ...

  9. python web篇 Django centos 命令版

    新建立一个虚拟环境,与其他python 包隔开互不影响 首先新建立一个目录,命名为xx, python3 下操作 $:python -m venv ll_env 注意在有多个Python环境下,使用 ...

  10. Ubuntu系统中各种文件颜色的含义

    蓝 色:文件夹 ,ls -l或ll时可以看到权限部分的第1个字母是d红色:压缩文件   绿色:可执行文件,包括jar白色:文本文件红色闪烁:错误的符号链接淡蓝色:符号链接黄色:设备文件灰色:其它文件 ...