指定されたパスがファイルなのかディレクトリなのか調べる
#!/bin/sh #fileordir.sh if [ -e "$1" ]; then if [ -d "$1" ]; then echo "$1 is a directory" else echo "$1 is a file (regular or special)" fi else echo "$1 is does not exist" fi
$ ./fileordir.sh 1.text 1.text is a file (regular or special)