Programming
We provide developers and engineers the guides and tutorials they...
Search
We provide developers and engineers the guides and tutorials they...
Content is king. It's not just about how you're going to write, b...
Looking for an engaging connection with thousands of other people...
Normally you cd into your html or code directory and then cd into your project's directory. In this article I'll explain how a simple bash function can save up your precious time for cd-ing into directories over and over again.
Normally you cd into your html or code directory and then cd into your project's directory. In this article I'll explain how a simple bash function can save up your precious time for cd-ing into directories over and over again.
Let's straight dive in and open up our bash file. In my case, it's bash_profile
Open up your terminal & follow along.
$ subl ~/.bash_profile
function cdhtdocs {
cd "C:/xampp/htdocs/$1"
}$ source ~/.bash_profile
Now lets assume you want to switch to your project's directory that's located in "C:/xampp/htdocs/foobar".
You'll have to simply type:
$ cdhtdocs foobar
Easy? Isn't it?
Bash functions are always helpful if you know the right use-case. If you're a terminal rookie, then this little trick might come in handy.
If you've any questions, leave us a comment below or ask us on Twitter.