-p标志在“ mkdir -p”中做什么?


Answers:


118

-p标志将创建嵌套目录,但前提是它们不存在。

例如,假设您有一个/foo拥有写权限的目录。

mkdir -p /foo/bar/baz  # creates bar and baz within bar under existing /foo

这也是幂等的操作,因为如果再次运行同一命令,将不会出错,但是不会创建任何错误。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.