1. 判断f根目录文件是否存在
#如果文件不存在需要创建
if [ ! -f "/creat_file" ]; then
mkdir -p /create_file
fi
#如果文件存在,需要删除,
if [ -f "/creat_file" ]; then
rm -rf create_file
fi
2. 判断指定目录的某个文件是否存在
file_1 = "/etc/init.d/rc.local"
if [ -f "$file_1" ]; then
rm -rf $file_1
echo "$file remove"
fi
///
参数意义: https://blog.csdn.net/qq_26620783/article/details/114582335