Skip to content

Instantly share code, notes, and snippets.

@foca
Created May 1, 2011 21:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save foca/950914 to your computer and use it in GitHub Desktop.
Save foca/950914 to your computer and use it in GitHub Desktop.
# cd into a matching gem directory. Pass a grep compatible
# regular expression. If you don't pass anything, it goes
# to the root gem directory.
cdgem ()
{
local gempath=$(gem env gemdir)/gems;
if [[ $1 == "" ]]; then
cd $gempath;
return;
fi;
local gem=$(ls $gempath | grep $1 | sort | tail -1);
if [[ $gem != "" ]]; then
cd $gempath/$gem;
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment