安装自制软件的非常简单的脚本:
#!/bin/bash
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
输出结果为:
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press RETURN to continue or any other key to abort
如何在这样的脚本中输入?期望是最好的路线吗?
答案 0 :(得分:22)
读取https://raw.github.com/Homebrew/homebrew/go/install的来源 - 它只会提示stdin是否为TTY。如果您从/dev/null
重定向标准输入,则根本不会提示。所以:
ruby \
-e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \
</dev/null
答案 1 :(得分:15)
这是yes
的用途:
yes '' | ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
答案 2 :(得分:0)
Per the lead maintainer of Homebrew:
echo | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
答案 3 :(得分:0)
这对我来说很好,
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null
答案 4 :(得分:0)
Press enter
如果要求按回车键
要对此更加清楚,请获取Brew文档
https://docs.brew.sh/