Stty help in korn shell

We are getting a following stty error when I am running a script.

stty: standard input: Inappropriate ioctl for device

I have some of following stty settings in my .profile. Tried other options still not able to fix it.

stty rows 40 cols 130 erase ^? intr ^C
export TERM=xterm
stty istrip

Would really appreciate your suggestions.

Thank you for trying to format your post, you're very close, please use code tags instead of bold tags, that is the button.

The problem is, stty doesn't make sense for anything which doesn't have a terminal.

I'm surprised ~/.profile is being executed for non-interactive logins though. Often there's code to avoid that. What do you have in ~/.kshrc ? And ~/.profile for that matter?

I think this may work for ksh:

case $- in
  *l*) stty ...  ;; 
  *) echo ;; # Do nothing
esac

bash would have *i* instead of *l*

1 Like

Thank you for correcting my post and responding. Thanks a ton.

I have .profile in my home directory. I kept the code you have given in it but still having the same result.

Should i remove rest all stty parameters in .profile file.

What do you have in ~/.kshrc ? and ~/.profile for that matter?

Here is the stty commands in my profile. I dont have any .kshrc file. Is this something needs to fixed by root level?

stty rows 40 cols 130 erase ^? intr ^C
export TERM=xterm
set -o vi
stty istrip

Depends what's happening. ksh loads ~/.kshrc, not ~/.profile. Usually that's its job to load ~/.profile or not depending on whether it's interactive.

What's in /etc/profile ? Perhaps your system handles it there