-e 判断对象是否存在
-d 判断对象是否存在,并且为目录
-f 判断对象是否存在,并且为常规文件
-L 判断对象是否存在,并且为符号链接
-h 判断对象是否存在,并且为软链接
-s 判断对象是否存在,并且长度不为0
-r 判断对象是否存在,并且可读
-w 判断对象是否存在,并且可写
-x 判断对象是否存在,并且可执行
-O 判断对象是否存在,并且属于当前用户
-G 判断对象是否存在,并且属于当前用户组
#!/bin/bash echo "basepath" $basepath data_predict="/data/data_predict/" data_predict_path=${basepath}${data_predict} echo "data_predict_path" $data_predict_path normal="normal.csv" normal_file=${data_predict_path}${normal} echo "normal" $normal_file if [ ! -d "$data_predict_path" ]; then mkdir "$data_predict_path" fi if [ ! -f "$normal_file" ];then touch "$normal_file" fi
basepath: /home/kg/qiaoruihua/jupyter_qiao/logistic_regression/gb_model
data_predict_path :/home/kg/qiaoruihua/jupyter_qiao/logistic_regression/gb_model/data/data_predict/
normal: /home/kg/qiaoruihua/jupyter_qiao/logistic_regression/gb_model/data/data_predict/normal.csv