linux - shell脚本中的-p和-s是什么意思?

标签 linux bash

我正在编写 shell 脚本,我对某些符号和条件有一些疑问。

什么是 -p 和 -s 表示 shell 脚本中的条件吗?

最佳答案

如果您使用的是 bash 内置条件(双方括号),请在手册中查找 bash(1) ,在“条件表达式”部分下。

如果您使用 sh 条件(单方括号),请在手册中查找 test(1)

不过,在这种情况下他们都会说同样的话:

-p 文件
如果文件存在并且是命名管道 (FIFO),则为 True。

-s 文件
如果文件存在且大小大于零,则为 True。

关于linux - shell脚本中的-p和-s是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28301399/

相关文章:

linux - 如何在将标准输出重定向到 Bash 文件时添加时间戳?

c++ - 使用 pthread_create 时出现 "Segmentation fault (core dumped)"

html - 根据 HTML 表格中的条件更改列颜色

bash - 从 bash 文件中读取星号字符 (*)

Linux bash 脚本行为怪异

ruby-on-rails - rails : Uninstall specific version of a library using gem

linux - 颠覆错误 : Can't open file '/var/svn/mobilesync/db/txn-current-lock' : Permission denied

linux - Puppet 分阶段重启

bash shell 脚本 for 循环中的两个变量

linux - telnet 确定开放端口(shell 脚本)