Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bypassing prompt (to press return) in homebrew install script

Tags:

bash

homebrew

Very simple script that installs homebrew:

  #!/bin/bash    ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" 

The output gives:

==> 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 

How do I press enter in a script like this? Would expect be the best route?

like image 307
cakes88 Avatar asked Aug 27 '14 19:08

cakes88


2 Answers

Reading the source of https://raw.github.com/Homebrew/homebrew/go/install -- it only prompts if stdin is a TTY. If you redirect stdin from /dev/null, it won't prompt at all. So:

ruby \   -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \   </dev/null 
like image 159
Charles Duffy Avatar answered Sep 26 '22 09:09

Charles Duffy


This is what yes is for:

yes '' | ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" 
like image 29
l0b0 Avatar answered Sep 22 '22 09:09

l0b0