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