Adding a test for the scalding repl

Also includes some refactoring of the shell scripts to avoid duplication of code.
dirname $0 can fail to identify the current working path for the distro under relative paths or other things... we should use

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

for it, its about the most reliable way to get the info