use*_*866 86 unix command-line directory-structure command-line-arguments
所以这似乎不是一个非常复杂的问题,但我找不到答案.我对-p选项在Unix中的作用感到困惑.我在创建子目录时使用它进行实验室分配,然后在该子目录中使用另一个子目录.它看起来像这样:
mkdir -p cmps012m/lab1
这是在具有正常权限的私人目录中(rlidwka).提前致谢!哦,有人会介意对"rlidwka"的含义做一些解释吗?我不是Unix的总菜鸟,但我并不熟悉这意味着什么.希望这个问题不是太模糊.
Pau*_* Bu 124
手册页是您可以找到的最佳信息来源......并且触手可及:man mkdir产生关于-p开关的信息:
-p, --parents
    no error if existing, make parent directories as needed
用例示例:假设我想创建目录hello/goodbye但不存在:
$mkdir hello/goodbye
mkdir:cannot create directory 'hello/goodbye': No such file or directory
$mkdir -p hello/goodbye
$
-p创造了两者,hello和goodbye
这意味着该命令将创建满足您请求的所有目录,而不是在该目录存在的情况下返回任何错误.
关于rlidwka,谷歌有一个很好的记忆缩写词:).我的搜索返回了这个例子:http://www.cs.cmu.edu/~help/afs/afs_acls.html
 Directory permissions
l (lookup)
    Allows one to list the contents of a directory. It does not allow the reading of files. 
i (insert)
    Allows one to create new files in a directory or copy new files to a directory. 
d (delete)
    Allows one to remove files and sub-directories from a directory. 
a (administer)
    Allows one to change a directory's ACL. The owner of a directory can always change the ACL of a directory that s/he owns, along with the ACLs of any subdirectories in that directory. 
File permissions
r (read)
    Allows one to read the contents of file in the directory. 
w (write)
    Allows one to modify the contents of files in a directory and use chmod on them. 
k (lock)
    Allows programs to lock files in a directory. 
因此rlidwka意味着:所有权限.
值得一提的是,正如@KeithThompson在评论中指出的那样,并非所有Unix系统都支持ACL.所以rlidwka概念可能不适用于此.
-p|--parent如果您尝试使用方法创建目录,将使用该top-down方法。这将创建父目录,然后是子目录,依此类推,如果不存在的话。
-p, --parents 如果存在则没有错误,根据需要创建父目录
关于rlidwka它意味着给予完全或管理访问权限。在这里找到它https://itservices.stanford.edu/service/afs/intro/permissions/unix。
mkdir [-switch] 文件夹名
-p 是一个可选的开关,它会创建子文件夹和父文件夹,即使父文件夹不存在。
从手册页:
-p, --parents no error if existing, make parent directories as needed
例子:
mkdir -p storage/framework/{sessions,views,cache}
这将在框架文件夹内创建子文件夹会话、视图、缓存,而不管“框架”之前是否可用。
| 归档时间: | 
 | 
| 查看次数: | 98531 次 | 
| 最近记录: |