美文网首页
2019-08-21 shell判断文件夹或文件是否存在

2019-08-21 shell判断文件夹或文件是否存在

作者: 五大RobertWu伍洋 | 来源:发表于2019-08-21 19:03 被阅读0次

    shell判断文件夹是否存在

    如果文件夹不存在,创建文件夹

    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