views:

47

answers:

1

Please tell me I'm missing something really obvious here:

$ cat ~/bashplay/f
#!/bin/bash
read -p 'RDY> ' x
echo $x

$ ~/bashplay/f
RDY> direct execution
direct execution

$ ssh somehost ~/bashplay/f
indirect via ssh
indirect via ssh

Note the missing "RDY>" prompt when using ssh. I see the same thing in python when using the "readline" package. Anyone know why?

+2  A: 

From man bash:

-p prompt
Display prompt on standard error, without a trailing new‐ line, before attempting to read any input. The prompt is displayed only if input is coming from a terminal.

Use the ssh option -t which forces pseudo tty allocation:

ssh -t somehost ~/bashplay/f
Dennis Williamson
Thank you, Sir Dennis! That was exactly the problem.
Kevin Little