Skip to main content
Tweeted twitter.com/#!/StackUnix/status/399748627662655488
edited tags; edited tags
Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k
edited title
Link
Anthony Ananich
  • 7.5k
  • 6
  • 36
  • 46

Bash: interactive remote prompt

Source Link
Anthony Ananich
  • 7.5k
  • 6
  • 36
  • 46

Bash: interactive prompt

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?