Skip to content
Advertisement

How to run npm or angular 2 ng serve command from Bash Script?

I am looking to create an interactive bash script for our development team (never did this before) as our project has various needs and due to future growth on the team I want this to be easy as pi.

Normally for my work on the team I would change directory to the angular folder and run ng serve which kicks off the frontend development server. How do I do that in a bash script?

So far I have this:

JavaScript

Thanks!

Advertisement

Answer

/angular seems weird as a working directory but if angular is a subdirectory of the one holding the script a

JavaScript

should work…

Maybe you could look at this question so you can call the script from any working directory.

Also note that you are missing a fi at the end of your if, there sould be spaces after opening and before closing bracket and choice should be referenced with a $ sign:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement