Cleans up some scripts with help from shellcheck.