Bash

Adding git status to the bash prompt

by Patrick Connelly posted on October 24, 2013

After talking to a friend of mine Jeff Larkin about bash prompts, I decided to modify what he did into a single line bash prompt. By adding the following to your .bashrc you’ll get the branch your on in git (if current directory is tracked), a color denoting the status of the branch as well as the return code of the last command (if non-zero)


Download and launch an Elluminate session from the command line

by Patrick Connelly posted on January 07, 2013

We use Elluminate Live! for some of our meetings, and it has always bothered me that I have to launch the browser to use Elluminate especially for reoccurring meetings. So one afternoon I set out to fix this problem. I wrote the following script and have been using it for about a month now without any issues. You can set the parameters at the head of the script if you have a reoccurring meeting you want to use, or set the parameters at run time (or in an alias for multiple reoccurring meetings) if you need too.


Swapping two files with a quick bash function

by Patrick Connelly posted on July 03, 2012

One thing I find myself doing a lot is swapping two files in bash. I thought about making this into a bash script then I realized 1) that’s over kill and 2) not as portable as I want. So, if you add this to your .bashrc then re-source it, you’ll be able to run the command swap to switch two files

function swap() {
  TMP_NAME="TMP_$RANDOM"
  mv "$1" "/tmp/$TMP_NAME" && mv "$2" "$1" && mv "/tmp/$TMP_NAME" "$2"
}