shell 脚本中的 cd 命令是否将 rvmrc 加载到目标目录中? [英] does cd command in a shell script load the rvmrc inside the destination directory?
本文介绍了shell 脚本中的 cd 命令是否将 rvmrc 加载到目标目录中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当你有类似的东西时..
when you have something like..
在 projectx 中给出一个 .rvmrc 文件,指定 ruby 1.9.2 并在我的系统上有两个 ruby(ree-1.8.7 和 ruby1.9.2)
given inside projectx an .rvmrc file specifying ruby 1.9.2 and having two rubies on my system (ree-1.8.7 and ruby1.9.2)
#!/bin/bash
cd applications/projectx
which ruby
ruby -v
最后两行输出 ree-1.8.7 及其路径,这不是我打算使用的.
the last two lines output ree-1.8.7 and its path which was not I intended to use.
推荐答案
是
<小时>Rvm 确实为 cd
定义了一个包装器,如下所示:
Yes
Rvm does define a wrapper around cd
that looks like this:
cd ()
{
builtin cd "$@";
local result=$?;
__rvm_project_rvmrc;
__rvm_after_cd;
return $result
}
很难说为什么您的 .rvmrc
不起作用.Rvm 确实支持特定于项目的 .rvmrc
文件,但您没有发布您的文件.
It's difficult to tell why your .rvmrc
isn't working. Rvm does support project-specific .rvmrc
files, but you didn't post yours.
这篇关于shell 脚本中的 cd 命令是否将 rvmrc 加载到目标目录中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文