I have a script which connects to a remote server and check if some package is installed:
ssh root@server 'bash -s' < myscript.sh
myscript.sh:
OUT=`rpm -qa | grep ntpdate`
if [ "$OUT" != "" ] ; then
echo "ntpdate already installed"
else
yum install $1
fi
This example could be simplified. Here is myscript2.sh
which has same problem:
read -p "Package is not installed. Do you want to install it (y/n)?" choise
My problem is that bash can not read my answers interactively.
Is there a way to execute local script remotely without losing ability to prompt user?