タグ

ブックマーク / tldp.org (2)

  • Other Comparison Operators

    7.3. Other Comparison OperatorsA binary comparison operator compares two variables or quantities. Note that integer and string comparison use a different set of operators. integer comparison -eqis equal to if [ "$a" -eq "$b" ] -neis not equal to if [ "$a" -ne "$b" ] -gtis greater than if [ "$a" -gt "$b" ] -geis greater than or equal to if [ "$a" -ge "$b" ] -ltis less than if [ "$a" -lt "$b" ] -lei

  • Introduction to if

    7.1.1. GeneralAt times you need to specify different courses of action to be taken in a shell script, depending on the success or failure of a command. The if construction allows you to specify such conditions. The most compact syntax of the if command is: if TEST-COMMANDS; then CONSEQUENT-COMMANDS; fi The TEST-COMMAND list is executed, and if its return status is zero, the CONSEQUENT-COMMANDS lis

  • 1