I have been writing my own Bash Scripts for a little while now. I am getting a better comprehension of it and I would like to start refining my code to be more elegant. I have recently developed this code to take a PHP file and comment out the code and add new code in.
If you could let me know how I could do better I would greatly appreciate it.
Bash Script:
## Set included files ## START ##
source /scripts/_inc/siteList.sh ## Description: Loads $siteList Array
## Set included files ## END ##
## Set Variables ## START ##
## Files in Use ## START ##
useFile='deferred.php'
tempFile='/scripts/_inc/deferredTextTemplate.php'
## Files in Use ## END ##
## File Contents ## START ##
newTop=$(head -n 15 $tempFile)
newBottom=$(tail -n 4 $tempFile)
## File Contents ## END ##
## Set Variables ## END ##
## Set Functions ## START ##
changeFile () {
    ## Info About Action to be intered into File.
    workInfo="\n// Edited: $(date)\n// Directory: $2"
    logTag="$(date): [$3 @ $2]"
    if [ -f "$1" ] ## Description: Does the file exist?
    then
        if grep -q F8kR8ikBiF "$1"; ## Description: Does the file contain this marker?
        then
            printf "%s Marker exists no changes necessary.\n" "$logTag" ## Description: Marker Exists!
        else
            ## Description: Print to Files that exist without Marker.
            orgFileCont=$(tail -n +2 $1 | sed -r 's/\/\*+ (.*) \*+\//\/\/ \1/')
            printf "%s\n%s\n%s\n%s\n" "$newTop" "$workInfo" "$orgFileCont" "$newBottom" > $1
            printf "%s File edited.\n" "$logTag"
        fi
    else
        printf "%s File not found.\n" "$logTag" ## Description: File does not exist.
    fi
}
## Set Functions ## END ##
## Set actions ## START ## 
## Loop though all direcotries listed in $siteList array and perform action
for siteDirectory in "${siteList[@]}"
do
   fileLocation="/site/$siteDirectory/$useFile"
   changeFile "$fileLocation" "$siteDirectory" "$useFile"
done
## Set actions ## END ## 
##EOF
Here is the Template File that is called:
<?php
/* Marker: F8kR8ikBiF */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* File Altered By Automated SH script via Cron: overwriteDeferred.sh
* script created by xxxxxxxxxxxxxxxxxxxx 10-24-14 in order to disable
* the built in cron functioanlity of Xxxxxxxx. Cron functionality will
* now be triggered by a System Cron Script: manCronTrigger.sh to run
* once per minute.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
{"moreDeferred":false}
/* Oringinal content * START * 
* Oringinal content * END */
// EOF


### ... ###markers are treated as headlines at the moment. Can you fix the indentation of the bash script, so that it shows up as you actually wrote it? \$\endgroup\$