简体   繁体   中英

in linux bash is there a way to simulate a y keypress without the use of xte or other programs like it

what i'm trying to do in bash is install applications like apache mysql-server and wanted to know if there is way to program a "y press" so that I don't have to manually type y and then enter when it says Do you want to continue [Y/n]?

thanks for the comment so for far i need to also do this to set up mysql but need to say n at the Disallow root login stage and change root password stage

also wondered if there is way to enter the following into mysql via the bash script CREATE DATABASE owncloud; #creates a database in mysql GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'select_database_password';

i'm relatively new to shell scripting

This is not a problem you should solve with shell scripting.

See if your package manager has an option to assume "yes" for all question, eg

apt-get --assume-yes install apache mysql-server

You might want to look at expect which can be used to automate a lot of tasks.

http://oreilly.com/catalog/expect/chapter/ch03.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM