The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 11-19-2007
Lakris Lakris is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 246
Do You even get a prompt for answer to Your read statement? I think that since ssh is non-interactive (not a controlling terminal) You can't have a terminal like session, either You must work with something like expect or keep the script locally and just "collect" whatever info You need from the remote host and process it locally.

Make a local script and run it locally:

Quote:
#!/bin/bash
ssh user@ubuntu ls -l \~/test
echo "Continue counting files starting with a ?"
read answer
if [ "$answer" = y ]
then
ssh user@ubuntu ls -l 'a*'
else
exit
fi
You must protect any arguments from being interpreted by Your local shell wich backslash or single quotes.
/Lakris