Skip to content
Russell Harmon edited this page Jan 8, 2016 · 5 revisions

mkdir -pm ignores -m for parent directories

Problematic code:

mkdir -p -m 0755 foo/bar/baz

Rationale:

When using -m 0755, the mode of the directory created will be set to 0755. When using -p, parent directories which do not exist will be created, but the mode specified by -m will only be used on the non-parent directory. The parent directories will get their access mode the default way, via umask(2).

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally