Bash脚本中新建文件夹跳过已有文件夹的方法


发布日期 : 2013-09-24 05:20:00 UTC

访问量: 202 次浏览

建立新文件夹的Bash脚本,若文件夹存在,则跳过。代码放到脚本里面运行,还是很方便的。

    #!/bin/bash
    dire="/home/bk/tmdown"
    if [ -d "$dire" ] ;
        then    echo "Directory Exists!"
    else
        mkdir "$dire"fi