Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在UNIX bash脚本中拆分目录路径_Bash_Shell_Unix_Scripting - Fatal编程技术网

在UNIX bash脚本中拆分目录路径

在UNIX bash脚本中拆分目录路径,bash,shell,unix,scripting,Bash,Shell,Unix,Scripting,我正在学习unixsbashshell脚本,并正在努力分割目录路径 e、 g./home/sample/test 我想获得路径中所有目录的权限。以下是示例输出。 e、 g 提前感谢。这是namei的工作(随util-linux提供): -m将获得权限模式 同时检查人员姓名i 示例: % namei -m /etc/passwd f: /etc/passwd drwxr-xr-x / drwxr-xr-x etc -rw-r--r-- passwd 这可能有帮助:stat--print

我正在学习unixsbashshell脚本,并正在努力分割目录路径

e、 g.
/home/sample/test

我想获得路径中所有目录的权限。以下是示例输出。 e、 g


提前感谢。

这是
namei
的工作(随
util-linux
提供):

  • -m
    将获得权限模式
同时检查
人员姓名i

示例:

% namei -m /etc/passwd
f: /etc/passwd
 drwxr-xr-x /
 drwxr-xr-x etc
 -rw-r--r-- passwd
这可能有帮助:
stat--printf“%A”/home
namei -m /home/sample/test
% namei -m /etc/passwd
f: /etc/passwd
 drwxr-xr-x /
 drwxr-xr-x etc
 -rw-r--r-- passwd