수요일, 8월 23, 2006

bash: comparison operator

  • String Comparison
    • str1 = str2
    • str1 != str2
    • str1 < str2
    • str1 > str2
    • -n str1 : str1 is not null
    • -z str1 : str1 is null
  • File Attribute Operator
    • -a file : file exists
    • -d file : file is a directory
    • -e file : same as -a
    • -f file : file is a regular file
    • -r file : read permission
    • -s file : file is not empty
    • -w file : write permission
    • -x file : execute permission
    • -N file : modified since it was last read
    • -O file : you own file
    • -G file : group ID matched yours
    • file1 -nt file2 : file1 is newer than file2
    • file1 -ot file2 : file1 is older than file2
  • Integer Conditions
    • -lt : Less than
    • -le : Less than equal
    • -eq : Equal
    • -ge : Greater than or equal
    • -gt : Greater than
    • -ne : Not equal

Refer page114, page 117 and page 121 of Learning the bash

댓글 없음: