Hello everybody. I am attempting to write a simple script using a for loop that counts the number of directories, the number of simple files. and the number of symbolic links in the current directory, and then prints this information. The output should look something like...
directories: 12
files: 20
links: 3
Here is what i have...
#!/bin/bash
linkCount=0
directoryCount=0
fileCount=0
for file in *
do
if [ -d $file]
then
directoryCount=$((directoryCount + 1))
elif [ -h $file]
then
linkCount=$((linkCount + 1))
elif [ -f $file]
then
fileCount=$((fileCount + 1))
echo "there are " + linkCount + " links."
echo "there are " + directoryCount + " directories."
echo "there are " + fileCount + " files."
for some reason it isnt doing what i want it to, can somebody please point me in the right direction?