How to create a custom command for the terminal?
Question
Every time I make a new webpage, I do the following commands in the terminal.
touch index.html
mkdir stylesheets
mkdir javascripts
mkdir images
mkdir sass
open index.html -a sublime\ text
I wish to automate this. like I wish I could type
init newProject
and all the above commands would execute on its own.
Is it possible?
Solution
You can do it with various methods, here's the easiest one in my opinion:
Paste this line in your ~/.bash_profile
function initProject { touch index.html && mkdir stylesheets && mkdir javascripts && mkdir images && mkdir sass && open index.html -a sublime\ text; };
Save it and execute source ~/.bash_profile
Right now you can type initProject
to get what you want.
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange