Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EULA Accept Bash Script

Tags:

linux

bash

I have a script that is attempting to install a bin.

Everything works fine except that the .bin opens up a EULA in more. You have to manually ctrl c out of this more instance before the script begins again and completes the install on its own.

Because this more is escaping the shell the script wont know what to run after its open. Is there a way to get expect to look for this and prevent it?

There is no custom flags to auto accept the eula.

Ive looked for solutions everywhere but nothing appears to work.

The command itself is simple enough but gets blocked right before the heredoc

/bin/bash gp.bin << AUTO
REST
OF
PARAMETERS
AUTO
like image 488
Mr S Avatar asked Nov 03 '25 13:11

Mr S


2 Answers

You should be able to use "q" to exit more, but that will only work interactively.

If the install script is written well, you shold be able to use something other than more as your pager. Try:

export PAGER=cat

And see if the behaviour changes.

If you're still stuck, you might have to look at something like Expect instead of the heredoc.

like image 135
Graham Avatar answered Nov 05 '25 12:11

Graham


expect can send Ctrl-C: http://expect.sourceforge.net/FAQ.html#q54

For example:

#!/usr/bin/env expect

spawn "/vendor/install/script.sh"
expect "EULA blah blah blah"
send \003
#rest of expect script...

But try the PAGER environment variable as already suggested.

like image 22
Greg Inozemtsev Avatar answered Nov 05 '25 11:11

Greg Inozemtsev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!