#!/bin/sh
if [[$#! = 1]];
Then
echo $ basepath;
echo;
Fi
path=$1;
Declare-a Statearray;
(Find $path-type f-print) | while read line;
Do
#echo "----"
echo $line;
#echo "----"
ftype= ' File-b "$line";
Ftype= ' echo ' $ftype | Cut-f 1-d "";
echo "$ftype";
Let statearray["$ftype"]++;
Done;
For type in "${!statearray[@]}";
Do
echo $type: ${statearray["$type"]};
Done
First, the function of the script:
Number of file types in the statistics directory
Problems occurred
ISO-8859 file types cannot be counted
Appear
Statearray:bad Array Subscript Error
To look at some documents, but did not find that the shell array in the correlation array subscript has strict restrictions, generally speaking is a string;
Test
Found
array["ISO-8859"]=1
bash:array["ISO-8859"]: Bad array subscript
But "ISO-8859" is also a string
So I still have some doubts! Ask Daniel again tomorrow.