Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
set -e # works without this
set -x # debug
source "$HOME/.rvm/scripts/rvm" #so 'cd' will change gemset when dotfiles present
#setup
rm -rf ~/tmp/dir_with_gemfile
mkdir -p ~/tmp/dir_with_gemfile
echo "source 'https://rubygems.org'" > ~/tmp/dir_with_gemfile/Gemfile
echo "gem 'rails'" >> ~/tmp/dir_with_gemfile/Gemfile
#end setup
#works
echo 'pre cd ~'
cd ~
echo 'post cd ~'
#exits after "cd"
echo 'pre cd ~/tmp/dir_with_gemfile'
cd ~/tmp/dir_with_gemfile
echo 'post cd ~/tmp/dir_with_gemfile'
>./broken_cd.sh
pre cd ~
post cd ~
pre cd ~/tmp/dir_with_gemfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.