Reputation: 91
I run a command in Linux remote machine using plink (from batch file in Windows).
For example:
plink.exe -ssh root@IP -pw pass -m testCommands.txt >> uninstall.log
In testCommands.txt
I have a command that perform uninstall of application,
the problem is that command of "uninstall" require an answer (y
or n
),
How can I send answer in addition to what I already send?
Here is the question I have:
[?7hAre you sure you want to completely remove "APPLICATION" and all of its components?
Yes [y, Enter], No [n]"
Upvotes: 1
Views: 2063
Reputation: 207345
There are several options...
Use a -y
or auto-confirm option on the command that removes the software, e.g.
pkg rm -yes somePackacge
Use a pipe to send the yes
, so that the command you run in PLINK looks like
printf "Yes\n" | pkg rm some_package
or
yes | pkg rm some_package
Make the command that you run on the Linux machine be based on expect
which can spawn
your remove command, wait
for a question and then send
it a confirmation. Some expect
examples here.
Upvotes: 1