LinuxShellProgramming
UnixShellProgramming
[ 와 [[ 의 차이점 : http://mywiki.wooledge.org/BashFAQ/031
Syntax : evaluates filename according to option
test -option filenameor
$ [ -f my_file ]
example : my_file이 존재하고 디렉토리가나 장치가 아닌 일반 파일이면 참(0)을 리턴
$ test -f my_file $ echo $? 1 $ [ -f my_file ]
options:
-s file file이 존재하고 크기가 0보다 크면 참 -r file file이 존재하고 읽을 수 있으면 참 -w file file이 존재하고 쓸 수 있으면 참 -x file file이 존재하고 실행할 수 있으면 참 -d directory 디렉토리가 존재하면 참