1.判断目录是否存在bash
dir="/data/www/godev" if [ -d ${dir} ];then echo "exist" else echo "not exist" fi
2.判断文件是否存在code
file="/data/www/godev/1.txt" if [ -f ${file} ];then echo "exist" else echo "not exist" fi
注意: []开始和结尾必定要空格,不然报错class