Make Your Development Easier with Shell Scripts
With many distractions already present in a developer's life, why commit to memory and type the same commands everyday? Automate it with shell scripts instead!
This write-up will show you how to use a shell script to easily open your editor, a local server and your dev environment in a browser. Essentially, run one command instead of many.
We'll look at each of the three commands. Then we'll put it all together into a shell script file.
First, let's start the server and database for my local build. I use the application XAMPP for that. Simply substitute your own server in the following command if it isn't XAMPP:
sudo /Applications/XAMPP/xamppfiles/xampp start;
Next, let's open the root folder that contains the project's code in our editor of choice. I like using the Atom editor, made by Github, but substitute the name of your favorite editor below:
open -a /Applications/Atom.app /Applications/XAMPP/htdocs/pixelOneZero/;
Lastly, let's open the URL for the development version of our project:
Good so far, right? Great.
Let's combine the above three commands into a shell file because we want to run all three with one convenient command.
Open your editor and paste the following into a new file named startDev.sh:
sudo /Applications/XAMPP/xamppfiles/xampp start; open -a /Applications/Atom.app /Applications/XAMPP/htdocs/pixelOneZero/; open http://localhost:8080/pixelonezero;To run this all-in-one script run the following command while in the same folder where you put startDev.sh: