Skip to content

Instantly share code, notes, and snippets.

@deepak
Forked from foca/functions.sh
Created August 28, 2012 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepak/3495246 to your computer and use it in GitHub Desktop.
Save deepak/3495246 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
pushd $gempath;
return;
fi;
local gem=$(ls $gempath | grep $1 | sort | tail -1);
if [[ $gem != "" ]]; then
pushd $gempath/$gem;
fi
}
@deepak
Copy link
Author

deepak commented Aug 28, 2012

forked to replaced cd with pushd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment