메뉴 건너뛰기

app

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

박영식2011.06.29 00:33조회 수 3174댓글 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" 
박영식 (비회원)
    • 글자 크기
[wget] 여러 정책을 무시하고 걍 긇어오기 (by 박영식) [MFC] VS2008로 제작시 첨부해야 할 파일들 (by 박영식)

댓글 달기

suritam9
2013.06.28 조회 2698
suritam9
2013.04.25 조회 6549
suritam9
2013.04.04 조회 2484
suritam9
2012.09.14 조회 2744
suritam9
2012.06.24 조회 2661
suritam9
2012.06.24 조회 3053
suritam9
2012.06.24 조회 2845
suritam9
2012.06.22 조회 2844
박영식
2011.09.22 조회 2880
박영식
2011.09.21 조회 2822
박영식
2011.02.18 조회 3294
첨부 (0)
위로