Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to answer yes in Bash Script

Tags:

linux

bash

Have a quick question,

imagine that I have this code:

mkdir -p $INSTALLDIR
sudo apt-get install -y git clojure leiningen
git clone git://github.com/maltoe/storm-install.git
./storm-install/storm_install.sh all `hostname` $INSTALLDIR

And this script will ask, do you want to install additional packages, and I want to say yes, How to do this automatically?

Or may be there is a way to kinda answer yes to any question by default?

like image 767
Vor Avatar asked May 17 '13 18:05

Vor


2 Answers

I not sure but i advice try:

echo yes | ./storm-install/storm_install.sh all `hostname` $INSTALLDIR
like image 114
user5068816 Avatar answered Sep 22 '22 23:09

user5068816


If you are running a script, try this:

yes "yes" | bash script.sh 
like image 40
Jimmy Avatar answered Sep 22 '22 23:09

Jimmy