Looping over Lines in file

# A bad way
IFS='
'
for x in $(cat $filename); do
  echo $x
done
 
# A better way
while read x; do
  echo $x
done < $filename

Random Code

# Get directory script is run from 
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"