Search code examples
solaris-10

How to count files in the directories with scripts for Solaris?


find  dirlocation -type d | while read dir; do 
    count=$(find "$dir" -type f | wc -l)
        echo "$dir ; $count"
done

This script working fine on Linux environment but when I run this on Solaris then message is Variable syntax. Can anyone help me to sort out this problem please?


Solution

  • Your script is written in the bash shell dialect. It will run on Solaris, too, but only within a bash shell. If you choose a different shell under Linux, it will stop running there, either.