Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定两个目录:/a和/b
/a
/b
并且 /a/.ruby-version有2.0.0-p353
/a/.ruby-version
2.0.0-p353
并且 /b/.ruby-version有jruby-1.7.9
/b/.ruby-version
jruby-1.7.9
以及以下/a/Procfile
/a/Procfile
a: ruby --version b: sh -c 'cd /b && ruby --version'
当我cd /a跑foreman run b
cd /a
foreman run b
然后我应该看到jruby 1.7.9 .. etc,但我看到了2.0.0-p353
jruby 1.7.9 .. etc
使用适当的 sudo 权限,您可以执行以下操作:
b: sudo -u $USER bash -l -c "cd /b && ruby --version"
这是我所知道的最安全的方式。