I just started learning Scripting in Shell Script, RHEL 6.3

This question already has an answer here:

  • Check if a directory exists in a shell script 32 answers

  • The simplest technique is to use mkdir -p which creates the directory — and any missing directories up the path — and does not fail if the directory already exists, so you can do it all at once with:

    mkdir -p "$LOCAL_WORKING_DIR" "$LOCAL_EVENT_LOG_WORKING_DIR"
    

    Note that the variables are enclosed in double quotes so that even if spaces (etc.) appear in the name, it will work sanely.

    链接地址: http://www.djcxy.com/p/17480.html

    上一篇: 何时在shell变量中引用引号?

    下一篇: 我刚开始学习RHEL 6.3 Shell脚本中的脚本