Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.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
如何打印出子文件夹ksh?_Ksh_Subdirectory_Ls - Fatal编程技术网

如何打印出子文件夹ksh?

如何打印出子文件夹ksh?,ksh,subdirectory,ls,Ksh,Subdirectory,Ls,在主文件夹中,它包含a、b和c子文件夹。我想把每个子文件夹一个接一个地打印出来 for d in ${ls -R main} do printf "$d" done 我想把它打印出来 A. B C 这样我以后就可以使用这些子文件夹来检查权限….如果您不必只使用ksh您可以使用find这样做: find /where/to/search/directories -type d -print (-type d确保只找到目录) 或者,如果您没有find,您可以这样做: ls -R

在主文件夹中,它包含a、b和c子文件夹。我想把每个子文件夹一个接一个地打印出来

 for d in ${ls -R main}
 do
     printf "$d"
 done
我想把它打印出来 A. B C
这样我以后就可以使用这些子文件夹来检查权限….

如果您不必只使用
ksh
您可以使用
find
这样做:

find /where/to/search/directories -type d -print 
-type d
确保只找到目录)

或者,如果您没有
find
,您可以这样做:

ls -Rdl /path/to/search/directories/* | awk '/^d/ {print $9}'
awk
解析
ls-l
输出以仅过滤出目录并打印表中的最后一个字段