I have the following script that do not run on bash:
for dir in directory1/subdirectory /directory2/subdirectory
echo "$dir $( du $dir |wc -l)"
done > ./message1
mailx -s "number of files" firstname.lastname@example.org < ./message1
But this script runs if I set shell to be ksh. I try to change the first line to #!/bin/bash, but the script does not work.