Simple Sand Samples |
Bash > ファイルやディレクトリの存在を調べる
exists.bash
if [ -e "hoge.txt" ]; then echo "Found." else echo "Not Found." fi
$ source exists.bash
Not Found.
$ touch hoge.txt
$ source exists.bash
Found.
$
Not Found.
$ touch hoge.txt
$ source exists.bash
Found.
$
* 確認環境 Debian Linux(Wheezy)