首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

bash 脚本编程5 条件语句

2012-09-21 
bash 脚本编程五 条件语句结合前面的例子,来写一个条件表达式。如果第一个参数没有,则输出no parameter,否

bash 脚本编程五 条件语句

结合前面的例子,来写一个条件表达式。如果第一个参数没有,则输出no parameter,否则输出第一个参数。

operatorproduces true if...number of operands-noperand non zero length1-zoperand has zero length1-dthere exists a directory whose name is operand1-fthere exists a file whose name is operand1-eqthe operands are integers and they are equal2-neqthe opposite of -eq2=the operands are equal (as strings)2!=opposite of =2-ltoperand1 is strictly less than operand2 (both operands should be integers)2-gtoperand1 is strictly greater than operand2 (both operands should be integers)2-geoperand1 is greater than or equal to operand2 (both operands should be integers)2-leoperand1 is less than or equal to operand2 (both operands should be integers)2





热点排行