Quoted By:
I really don't get what I'm doing wrong in this script. The purpose of it is to print the total number of files, folders and the sum of the two. Yet it doesn't produce the results that I want. Could someone help me out?
#!/bin/bash
vector=(`ls /home/smallverse/Scripts`)
ct=0
file=0
dir=0
for ct in "${vector[@]}"
do
if [ -f ${vector[$ct]} ]
then
let file++
else
let dir++
fi
done
echo "Files: $file"
echo "Folders: $dir"
echo "Total: ${#vector[@]}"