This script,called array-2, when given the name of a directory, prints a listing of the files in thedirectory 这个脚本,称为 array-2,当给定一个目录名,打印出目录中的文件列表,伴随着每个文件的文件所有者和组所有者。在文件列表的末尾,脚本打印出属于每个所有者和组的文件数目。 这里我们看到的(为简单起见而缩短的)结果,是给定脚本的目录为 /usr/bin 的时候: [me@linuxbox ~]$ array-2 /usr/bin /usr/bin/2to3-2.6 /bin/bash 2 3 # array-2: Use arrays to tally file owners 4 5 declare -A files file_group file_owner -d "$1" ]]; then 8 echo "Usage: array-2 dir" >&2 9 exit 1 10 fi 11 12 for i in "$1