文件或目录是否存在

#!/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

上一篇:oracle 创建表空间、用户 4个步骤


下一篇:批量转换word为pdf