小编kjb*_*ley的帖子

循环遍历Bash数组:获取循环中间的下一个元素

搜索已经读入文件的数组(lines_ary [@]),我试图在文本中找到一个版本号.我在这里寻找Release,所以我可以找到下面的版本号.

在执行以下循环时,有没有办法在bash脚本中访问数组中的下一个元素?

for i in ${lines_ary[@]}; do
 if [ $i == "Release:" ] ; then
  echo ${i+1}
 fi
done
Run Code Online (Sandbox Code Playgroud)

这只打印出'1',而不是'4.4'.

bash loops for-loop element

6
推荐指数
2
解决办法
7223
查看次数

为什么安装Ruby 1.9.3会出现404错误?

我最近擦了我的电脑(OS-Mac OS X 10.6.8),我正在重新安装我的所有开发工具.我再次安装了RVM; 但是,它不会让我安装Ruby 1.9.3.

到目前为止,我尝试过:

  • rvm install 1.9.3
  • rvm install 1.9.3-p194
  • rvm install 1.9.3-p448
  • rvm install 1.9.3 --with-gcc=clang

全部返回相同的命令行错误:

Searching for binary rubies, this might take some time.

No binary rubies available for: osx/10.6/x86_64/ruby-1.9.3-p448.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.

Warning: port definitions are more than two weeks old, consider using selfupdate

Certificates in '/opt/local/etc/openssl/cert.pem' already are up to date.

Requirements installation successful.

Installing Ruby …
Run Code Online (Sandbox Code Playgroud)

ruby installation ruby-on-rails version rvm

5
推荐指数
1
解决办法
2034
查看次数

标签 统计

bash ×1

element ×1

for-loop ×1

installation ×1

loops ×1

ruby ×1

ruby-on-rails ×1

rvm ×1

version ×1