feat: Initial commit
This commit is contained in:
24
Lab07/es4.sh
Normal file
24
Lab07/es4.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -A acr
|
||||
|
||||
if [ $# -ne 1 ]
|
||||
then
|
||||
echo "Missing filename"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for word in `cat $1`
|
||||
do
|
||||
if [ -v "acr[$word]" ]
|
||||
then
|
||||
acr[$word]=$((acr[$word]+1))
|
||||
else
|
||||
acr[$word]=1
|
||||
fi
|
||||
done
|
||||
|
||||
for key in ${!acr[*]}
|
||||
do
|
||||
echo "${key}: ${acr[$key]}"
|
||||
done
|
||||
Reference in New Issue
Block a user