Thursday, July 21, 2011

Some quick functions from my .shrc_local

It's pretty well known that I have a fairly hefty .shrc which I created sometime ago to address the little things that bugged me when going from FreeBSD to say Linux or from OS X to maybe Cygwin ( ${deityOfYourChoice:="God"} help me ).  When I published it, I tried to make sure that it was both functional for the general public (ok.. admittedly a self-selecting sub-sub-sub culture of the general public) and generic enough to not get in the way of people who want to extend it for their specific needs.
Enter: .shrc_local. There are other places where one could make customizations and I actively encourage that, but if you just want something simple you can create a ~/.shrc_local and drop it in there.

Here is one example of that (pulled directly from my .shrc_local):

rvm(){
    #Quick wrapper function to make RVM (https://rvm.beginrescueend.com/) work
    #if you're using a sane shell instead of 'bash'. Bash still needs to be 
    #installed as RVM depends on it. This function simply wraps around bash
    #passing in the init script (~/.rvm/scripts/rvm) and the parameters so that
    #you aren't stuck when your default shell is something other than bash or 
    #zsh
    echo "
        source ${HOME}/.rvm/scripts/rvm 
        rvm $*
    " | bash
}


Here is another:

update_pkgsrc(){
    #Quick function to update my pkgsrc source tree.
    export CVSROOT=anoncvs@anoncvs.NetBSD.org:/cvsroot
    cd /usr/local/pkgsrc
    cvs update -A -Pd
}

I hope others will find these useful but if not.. at least I've posted them somewhere so that I can find them easily instead of searching through my tarsnap archives.. ;-)

No comments:

Post a Comment