Here is the fix
#!/usr/bin/env bash
dir1=${1:-.}
dir2=${2:-.}
echo $dir1 $dir2
for dir in $dir1 $dir2
do
ordinary=$(find $dir -type f | wc -l )
executable=$(find $dir -type f -executable | wc -l)
directories=$(find $dir -type d | wc -l)
links=$(find $dir -type l | wc -l)
echo "$dir: $ordinary $executable $links $directories"
done
Explanation
dir1=${1:-.}
assign $1 to dir1 if $1 is exist, otherwise, give the default value.
..
means current directory.