mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2174 (markdown)
13
SC2174.md
Normal file
13
SC2174.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
## -m will be ignored for parent directories
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
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)].
|
||||||
|
|
||||||
|
[umask(2)]: http://man7.org/linux/man-pages/man2/umask.2.html
|
Reference in New Issue
Block a user