write a shell script that calculates the following information for the contents of a given directory. The directory is to be specified as a single command line argument to your script. You do not need to account for any contents of nested subdirectories -- just the direct contents of the specified directory.
The total number of directories that are in the given directory (note that these are subdirectories). The total number of files in the given directory. The number of items (files/directories) in the current directory that are readable. The number of items (files/directories) in the current directory that are writable. The number of items (files/directories) in the current directory that are executable.
I tried :
if [ -d $file ]
then
counter=expr $counter + 1
echo "Number of directories :" $counter
fi