下面是我项目中我试图理解的代码。谁能解释一下它叫什么? (-s 和 -a)
if [***-s*** $A ***-a -s*** $B]
then ..
else ..
fi
还有,是否有一本字典,其中列出了所有 - 及其用法?
Google 搜索与我需要的信息不完全匹配。因为我不知道叫什么。请帮忙!
提前谢谢您!
您正在寻找条件表达式。假设您使用的是 bash,您可以查看 Bash 参考手册的 6.4 Bash 条件表达式 部分。
-a file
True if file exists.
-b file
True if file exists and is a block special file.
-c file
True if file exists and is a character special file.
-d file
True if file exists and is a directory.
-e file
True if file exists.
-f file
True if file exists and is a regular file.
-g file
True if file exists and its set-group-id bit is set.
-h file
True if file exists and is a symbolic link.
-k file
True if file exists and its "sticky" bit is set.
[...]
请参阅上面引用的文档以获取完整列表。