-gt在这里是什么意思:
if [ $CATEGORIZE -gt 0 ]; then
这是我正在使用的bash脚本的一部分。
另外,我在哪里可以找到一个“标志”的列表,这些“标志”放在那里,这样我以后就可以参考了?
发布于 2014-04-08 10:25:05
-gt的意思是“大于”,在算术上比较
[是(特别的) test的别名(带有]的强制最后一个参数,以使其看起来像一对括号)。
bash有自己的“内置”版本的[/test,所以任何bash参考(例如man bash、info bash或http://www.gnu.org/software/bash/manual/)都会记录该版本,或者man [/man test应该为你提供标准独立版本的文档。
具体地说,是this page gives an overview of the command, as implemented by bash和this page lists the available operators。
除了算术和字符串测试之外,您可能还会遇到与[ -e /hard/coded/path/$variable_filename ]中一样的针对“文件存在”的-e测试
bash还包括一个稍微扩展的版本in the form of [[ ... ]]。
https://stackoverflow.com/questions/22926419
复制相似问题