Operating System - HP-UX
1830898 Members
3207 Online
110017 Solutions
New Discussion

script with rsh has error stty : : I/O error

 
Iyappan
New Member

script with rsh has error stty : : I/O error

I run rsh through a k shell script. In the middle, if it dies a abnormal death, then "new line" are not working.
the stty output is :
rows = 24; columns = 80; ypixels = 0; xpixels = 0;
min = 1; time = 0;
erase = ^h; eof = ^a; swtch = ;
brkint -inpck -istrip icrnl -ixany imaxbel onlcr tab3
-icanon -echo echoe echok echoctl echoke iexten

Here note that "icanon" and "echo" are negative.

If I try to correct this error by typing in the shell script, "stty icanon echo", then it gives a "stty : : I/O error". Tried setting "set i" and "tty -s". Still this error continues. Any ideas how to set the newline back in the script itself.
3 REPLIES 3
Victor Fridyev
Honored Contributor

Re: script with rsh has error stty : : I/O error

Hi,

I hope,
stty sane
can resolve the problem.
If your stty settings are not standard, you can store them by
STT=$(stty -g)
and restore by
stty $(echo $STT)

BTW, how do you run rsh ?
remsh hostname command
or
ramsh hostname -n command ?

The second way is better.

HTH
Entities are not to be multiplied beyond necessity - RTFM
Dave La Mar
Honored Contributor

Re: script with rsh has error stty : : I/O error

Not sure if this will help in your error or not, but in our remsh scripts the following variable declaration resolved stty errors-
export DISPLAY="$(hostname):00"

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Bill Hassell
Honored Contributor

Re: script with rsh has error stty : : I/O error

rsh (remsh on HP-UX) is a specialized coomand that is not interactive. The problem is that your remote machine has not protected /etc/profile and .profile (assuming POSIX or Korn shell) for non-interactive runs. The stty command (and tput ttytype tset tabs) must have a real terminal and your script is not a terminal. In both /etc/profile and .profile, use the tty command to encapsulate these commands:

if tty -s
then
...commands like stty tput tabs, etc
fi

In other words, the remote login must bypass these special commands when using remote shell in a script.


Bill Hassell, sysadmin