I am trying to recurse into folders and then run commands on them, using bash script. Any suggestions?
Some basic shells miss commands like 'find' and some of their commands don't support recursivity. In that case you can use this script to run the desired command in all subdirs in the tree:
CDIR=$(pwd)
for i in $(ls -R | grep :); do
DIR=${i%:} # Strip ':'
cd $DIR
$1 # Your command
cd $CDIR
done
If you name the above "recurse.sh" then use:
./recurse.sh
Example (change the owner/group to 'root' of all files in the tree):
./recurse.sh "chown 0:0 *"