Hulk, Bash!

Bash Profiles

Hulk Bash

One of the cool things we've had an opportunity to do at Metis was to play with our .bash_profile files. I've edited mine before but never really knew exactly what it did. This time around, I wanted to make sure that I try some more complex things on it to make my life easier. A bash profile is basically a file that runs when you login (bashrc is pretty much the same thing so I didn't include it in this post). So you can put aliases for commands or change the standard $PATH on your terminal.

So one thing that I wanted to do since I moved my blog over to ghost/buster as I wrote about here, was to move the whole generate command and git commits into one command. I figured I couldn't just do it with an ALIAS because I would want a unique git commit message. So here is a short function I wrote that allows me to generate the static pages of my blog and upload the changes to my github and live blog in one command with a unique commit message:

function gen() {  
cd Projects/ghost/  
buster generate --domain=  
cd static  
git add .  
git commit -m "$1"  
git push  
open -a Google\ Chrome  
cd ~  

So this just goes into your bash profile. And to call it, now all I have to do is this in my root directory and all the updates are posted! And it will also open up my site after the update so I can check:

gen "Unique Github Message"  

And there are obviously a lot of other things you can do with bash profiles and other dotfiles. Here are some really cool examples:

What I Learned Today:
Making slow drip coffee is slow... but so worth it!