Starting up `mongod` like this will cause the script to appear to hang until the user quits the `mongod` process. You'll want to run with the `--fork` option instead, as in

    if [ "$dummy" = "m" ]; then mongod --fork; fi