安装自制软件的非常简单的脚本:
#!/bin/bash
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Run Code Online (Sandbox Code Playgroud)
输出给出:
==> 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
Run Code Online (Sandbox Code Playgroud)
如何在这样的脚本中按Enter键?期望是最好的路线?
Cha*_*ffy 25
阅读https://raw.github.com/Homebrew/homebrew/go/install的来源- 它只会提示stdin是否为TTY.如果你重定向stdin /dev/null,它根本不会提示.所以:
ruby \
-e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \
</dev/null
Run Code Online (Sandbox Code Playgroud)
l0b*_*0b0 19
这yes是为了什么:
yes '' | ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Run Code Online (Sandbox Code Playgroud)
echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Run Code Online (Sandbox Code Playgroud)