Posted on 06-10-2020 08:57 PM
I have a uninstaller that is a Unix executable but it prompts for confirmation.
Do you wish to continue (yes/no)?
So when I have a script call the executable it just hangs forever, how can I script it so the uninstaller runs correctly?
I've tried
sudo "./Uninstall -Yes"
and
sudo "./Uninstall -Y"
No luck. any advice would be appreciated.
Posted on 06-10-2020 10:14 PM
Hi @djrory ,
You could try:
#Respond to Yes or No prompt with a sleep time of 5 seconds
(sleep 5; printf "Yes") | "/path/to/uninstaller"
Not sure if this is the same program, but is there a uninstall.sh, that'd probably be your best bet
sudo "/Library/Application Support/Checkpoint/Endpoint Security/uninstall.sh"
Posted on 06-10-2020 10:33 PM
@shaquir I found that out just after I posted this, Uninstaller seems to just call the uninstall script with the line
sudo "./uninstall" --uninstall
So I put that in the script and it worked.
Thanks for the response though, always handy to know!
Posted on 06-10-2020 10:35 PM
It's something I've never needed to really write myself, but I believe expect
might be a solution for what you need. It used to be needed when accepting the Xcode license automagically with a script, since xcodebuild
used to require someone enter "accept" into the Terminal window.
You'd want something like this as a script body:
/usr/bin/expect -f
set timeout -1
spawn ./path/to/your/interactive/script.sh
expect "Do you wish to continue (yes/no)"
send "yes
"
expect eof