Skip to content

Instantly share code, notes, and snippets.

@thomaseizinger
Last active March 26, 2019 09:49
Show Gist options
  • Save thomaseizinger/08d8bde9bf814ca75805d962cc101e72 to your computer and use it in GitHub Desktop.
Save thomaseizinger/08d8bde9bf814ca75805d962cc101e72 to your computer and use it in GitHub Desktop.
Simple ZSH-Script that aliases all binaries found in the ruby bin directory so they can be called from a babun shell.
# Put this file under ~/.oh-my-zsh/custom if it should be automatically run for every babun shell that is opened.
# Credits to http://stackoverflow.com/questions/3831131/rubygems-cygwin-posix-path-not-found-by-ruby-exe#comment61900449_19424481
echo "Aliasing all ruby binaries."
if [[ -n "$(which ruby 2>/dev/null)" ]]; then
RUBY_BIN=$(cygpath -u $(ruby -e 'puts RbConfig::CONFIG["bindir"]'))
for f in $(find ${RUBY_BIN: : -1} -regex ".*bat$"| xargs -n1 basename); do
alias ${f%.bat}=${f}
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment