: #!/bin/bash
: filename="/tmp/dir/$1"
: if [ -f $filename ]; then
: echo "File is exist : $filename"
: else
: echo "File is not exist"
: fi
: /tmp/dir/ 디렉토리에 파일이 하나 존재하는데 물론 없을수도 있고요...
: 파일이 있는지를 체크하고 싶은데... 위와 같이 했더니...
: 실재 파일은 하나 있는데... 없다고 나오네요...
: 어떻게 해야 파일존재유무를 체크하지요?
if <>에 사용하신 -f 는 test의 option으로
-f : File exists and is a regular file
-e : File exists
-w : File exists and is writable
-x : File exists and is excutable
-d : File exists and is a directory 등의 option들이 있습니다.
님께서 혹시 해당 directory에 어떤 file이 있는 상태에서 실행하셨는지?
file의 유무만을 check하실려면 -e option이 가장 적절하지 않을런지...