A related idiom that I like is python's use of if __name__ == "__main__": ...
if __name__ == "__main__":
This allows modules to be used as a library, instead of automatically executing code when you import (or source) that file. In shell scripts I do as you do, and encapsulate the program logic in functions, and then at the end of the script have:
if [[ "$(basename "$0" .sh)" == "MyScript" ]]; then
On the step:
npm install generator-angular generator-karma --no-bin-links
I kept getting a "peerinvalid generator-karma" error.
npm install generator-angular --no-bin-links
also installs generator-karma.
Thanks for the nice instructions!