Solution to problem 3

moon.sh is the top level script