2. MacOS does not support ll (need to use LS-L implementation), in fact ll under Linux is ls-l shortcut keys.
LS Displays the file in the current directory.
LS-L Displays the file details in the current directory.
#以下命令均不包含 ".", "..." Directories, and the "." The beginning of the hidden file, if required, ll need to add the-a parameter # number of files in the current directory, do not include subdirectories ll |grep "^-" |wc-l# the current directory number, do not include subdirectories ll |grep "^d" |wc-l# the current directory number of files, including subdirectories ll-r| grep "^-" |wc-l# the number of directories under the current directory, including subdirectories Ll-r|grep "^d" |wc-l
1. Traversing the Directory
#!/bin/bashfunction Getdir () {for element in ' ls $ ' do dir_or_file=$1 "/" $element if [-D $dir _or_file ] then getdir $dir _or_file else echo $dir _or_file fi done}root_dir= "/home/test" Getdir $ Root_dir
MacOS Shell Programming Notes