메뉴 건너뛰기

app

[sh] 쉘스크립트 비교 파라미터

박영식2011.06.29 00:33조회 수 2838댓글 0

    • 글자 크기
if [ "$X" -lt "0" ]
then
  echo "X is less than zero"
fi
if [ "$X" -gt "0" ]; then
  echo "X is more than zero"
fi
[ "$X" -le "0" ] &&
      echo "X is less than or equal to  zero"
[ "$X" -ge "0" ] &&
      echo "X is more than or equal to zero"
[ "$X" = "0" ] &&
      echo "X is the string or number "0""
[ "$X" = "hello" ] &&
      echo "X matches the string "hello""
[ "$X" != "hello" ] &&
      echo "X is not the string "hello""
[ -n "$X" ] &&
      echo "X is of nonzero length"
[ -f "$X" ] &&
      echo "X is the path of a real file" ||
      echo "No such file: $X"
[ -x "$X" ] &&
      echo "X is the path of an executable file"
[ "$X" -nt "/etc/passwd" ] &&
      echo "X is a file which is newer than /etc/passwd" 
박영식 (비회원)
    • 글자 크기

댓글 달기

박영식
2006.06.18 조회 2524
박영식
2005.03.25 조회 2254
박영식
2003.12.25 조회 4052
박영식
2003.12.19 조회 3612
박영식
2003.11.05 조회 17690
박영식
2003.11.05 조회 2420
박영식
2003.11.05 조회 2627
박영식
2003.11.05 조회 2326
박영식
2003.11.05 조회 2363
박영식
2003.11.05 조회 3387
박영식
2002.06.14 조회 2732
박영식
2002.04.18 조회 3538
박영식
2002.04.18 조회 3435
첨부 (0)
위로