Script to create Induction Loops directory:


mkloops.sh

*********************************
#!/bin/bash
# mkloops.sh
# run as root if necessary
# 2007-10-11:SRL DGA version 1.0

echo mkloops

newdirname="INDUCTION LOOPS"

for file in read *
#           ^  Bash performs filename expansion
#+             on expressions that globbing recognizes.
do

    if [ -d "$file" ]
    then
        echo "processing: $file"  # all files in $PWD (current directory).
        # get owner and group of dir
        owner="$(ls -d -l "$file"|/bin/awk '{print $3}')"
        group="$(ls -d -l "$file"|/bin/awk '{print $4}')"
        /bin/mkdir  "$file/$newdirname"
        $(chown $owner:$group "$file/$newdirname")
    fi
done
              
echo; echo

exit 0
********************************************

With changes to the variables this can be put to other uses.