• shell脚本中 if 判断时候-s是什么意思


    -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.

  • 相关阅读:
    第27课二阶构造模式(上)---------出现的背景
    第26课 静态成员函数
    第25课类的静态成员变量
    第24课经典问题解析(下)--------类的成员函数和成员变量隶属某个具体对象吗
    第24课经典问题(中)-----关于const对象的疑问
    第24课经典的问题(上)---------对象的构造顺序与析构顺序
    第23课 神秘的临时对象
    断剑重铸007
    DG on Windows 10 S: 执行任意代码
    断剑重铸006
  • 原文地址:https://www.cnblogs.com/keystone/p/10710186.html
Copyright © 2020-2023  润新知