Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's the issue? Getting a ENOTTY error on a function call tcgetattr() when the process is invoked from a script. The error comes only when ran from the script. If it is run from an interactive shell, it works fine.

What exactly is process doing ? The process is trying to turn off the canonical processing of input from stdin. This is required because the inputs may be coming in bursts and may hog the input queue. For this the process gets the terminal file descriptor parameters for stdin using tcgetattr() function. and then turns off the canonical flag in termios struct.

Reason for error ? When a script is invoked it runs in non interactive mode, which means there is no tty attached and hence it is not available to the process invoked from the script. That's why the process is returning ENOTTY.

Looking for ? Workaround to still be able to invoke the process from script without any changes in program ? (Tried forcing interactive shell using -i in script, not working!!!)


share|improve this question
What is the process doing? What ioctls are being invoked, for what reason? – grawity Jan 15 '13 at 16:45
The process is trying to get the terminal file descriptor parameters for stdin using tcgetattr() function. This function is returning ENOTTY. I am not willing to change the program for process. so for now, I am using the script to invoke the process in a new terminal emulator (xterm). Just wondering, if there is any way around where I am not forced to spawn another xterm ? – Mohit Jan 16 '13 at 10:02
Let me rephrase -- why is the process trying to do that? Does it display an interactive UI, or something? Also, why are you saying "all scripts are non-interactive" -- are you talking just about your system, or about scripts in general? – grawity Jan 16 '13 at 12:52
Made the required edits. Hopefully. – Mohit Jan 17 '13 at 9:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.