Score:0

Interact with a terminal UI using a shell script

et flag

I want to automate the installation of phpmyadmin using a shell script.

sudo apt install phpmyadmin is straight forward but I don't know how to automate the completion of this pop-up.

https://i.stack.imgur.com/DfKcZ.png

What I need to do, is to press space to select the desired option, then enter to confirm it.

hr flag
Instead of trying to interact with the dialog, consider pre-seeding your choice using `debconf-set-selections` - see for example [How can I prevent apt-get/aptitude from showing dialogs during installation?](https://askubuntu.com/questions/339790/how-can-i-prevent-apt-get-aptitude-from-showing-dialogs-during-installation) and [How can I install apt packages non-interactively?](https://askubuntu.com/questions/556385/how-can-i-install-apt-packages-non-interactively)
Score:2
cn flag
raj

Install expect and write an expect script that answers the prompts. This will look something like this (warning - not tested in any way):

#!/usr/bin/expect
spawn sudo apt install phpmyadmin
expect "server to reconfigure automatically"
set send_slow {1 0.5}
send -s " \r"
wait

This will run sudo apt install phpmyadmin command, wait until a text server to reconfigure automatically appears on the screen (if you need to provide a password to sudo you should insert additional commands to handle this), then send two characters, space and Enter with 0.5 second delay between them, and finally wait until the command terminates.

Look here for more information about expect:

https://www.slashroot.in/expect-command-tutorial-linux-example-usage

http://tcl.tk/man/expect5.31/expect.1.html

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.