shell 에서 test condition parameter 종류
-d dir file exist and dir ?
-e file exist
-f file exist and regular file ?
-r readable file
-s file exist or size not zero
-w writable
-w excutable
if test $# –eq 0 then echo “supply one argument “ exit 1 fi | |
if test –f “$1” then echo “$1 is file” else echo “$1 is not a oridnary file” fi |
$> bash example.sh
or
$> . example.sh
or
chmod u+x example.sh
./example.sh
댓글