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...
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?