shell判断文件夹是否存在
如果文件夹不存在,创建文件夹
if [ ! -d "/myfolder" ]; then
mkdir /myfolder
fi
判断文件不存在则拷贝并修改之
[ ! -f "config.php" ] && cp default.php config.php && sed -i 's/localhost/mysql/g' config.php
if [ ! -d "/myfolder" ]; then
mkdir /myfolder
fi
[ ! -f "config.php" ] && cp default.php config.php && sed -i 's/localhost/mysql/g' config.php
本文标题:2019-08-21 shell判断文件夹或文件是否存在
本文链接:https://www.haomeiwen.com/subject/ntoisctx.html
网友评论