June 20th, 2003, 10:52 PM
Can't run script in cygwin shell window
I have the following Bourne shell script (that's why I don't need to have #!/bin/sh at the top):
telnet macbeth 9999 << EOF
maketransact 9102123 12 41
This file is created on an IRIX machine and the 'macbeth' machine is an HPUX machine. This script works with no problems, sending the commands to macbeth:9999 and echoing the expected results back to stdout.
However, when the same script is executed in a cygwin shell (doesn't matter if it's bash or tcsh) running on Win2K, it doesn't work. All I see is the regular telnet greeting, and then it exits. Note that the connection WAS made. I checked the logs on macbeth:9999 and I saw that the commands in the script didn't even make it to the server.
Does anyone know why it doesn't work in the cygwin shell, and how to solve it? I am thinking it might have to do with the fact that on Unix, newlines are 0xA and in Windows/DOS, it's 0xD 0xA (carriage return/line feed sequence). I even tried ftp-ing down the IRIX version of the script to the PC in 'binary' mode to preserve the 0xA and then running the script on the PC in the cygwin window. It doesn't help.
Anyone has any idea how to make it work in the cygwin window on the PC?