#!/bin/sh if [ -e $1 ]; then echo \"$1\" exists. if [ -f $1 ]; then echo \"$1\" is a file. else echo \"$1\" is not a file. fi else echo \"$1\" does not exist. fi実行例
filex.sh という名前で上記スクリプトを書く。
# ls filex.sh testdir test.pl # sh ./filex.sh testdir "testdir" exists. "testdir" is not a file. # sh ./filex.sh test.pl "test.pl" exists. "test.pl" is a file.