分享 有关 BASH 的一篇好文, 讲解 < <(...) 以及 <<<("`...`")

zw963 · September 09, 2012 · Last by zw963 replied at September 09, 2012 · 4002 hits

分享一篇有关 BASH 的文章,解决了之前的诸多疑问。

http://linuxshellaccount.blogspot.com/2008/08/using-bash-to-feed-command-output-to.html

汗颜,用 Linux 一年了,才知道这个用法,之前装老版本的 rvm 的时候,就很奇怪,为什么有这么奇怪的用法:

bash < <( curl https://raw.github.com/rocky/emacs-dbgr/master/install-from-git.sh )

现在完全明白了。不过最新的 rvm 已经改为使用 bash 内置的 -s 参数了。

curl -L https://get.rvm.io | bash -s stable --ruby

这样增加了灵活性,因为服务器端的脚本名称 (就是上面那个示例当中的 install-from-git.sh) 就不再重要了。

注意:后面的 stable 以及 --ruby 作为位置参数, 传递给了 BASH 脚本。

看起来是没了,其实 install-from-git.sh 还是至关重要的,那个 https://get.rvm.io 就重定向到了 https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer

#1 楼 @fenprace

我说名字不重要了,反正能执行就可以。这不换成其他名字了?

You need to Sign in before reply, if you don't have an account, please Sign up first.