1837047 Members
3181 Online
110111 Solutions
New Discussion

stty: not a typewriter

 
Marylou Kohlmeier
Frequent Advisor

stty: not a typewriter

When I run the script:
su - ${USER} -c .....

I get the error below.
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter

Can somebody provide assistance please?

thank you,
Marylou Kohlmeier
MIS Dept
College of the Canyons
3 REPLIES 3
Paul Sperry
Honored Contributor

Re: stty: not a typewriter

James R. Ferguson
Acclaimed Contributor

Re: stty: not a typewriter

HI:

When you use 'su -' you are causing the user's login profile to be executed. This sources (reads) the login profile to create a login-like environment with all the attendant enviornmental variable set just as a login shell would establish.

That's fine except for the fact that standard login profiles contain terminal-oriented commands like 'stty' and 'tset' which expect to be interactive with the controlling terminal.

Since there is no terminal associated with this process, you get the errors seen.

One way to circumvent this is to amend your '.profile' to *conditionally* execute terminal-oriented commands only when the process is associated with a terminal:

if [ -t 0 ]; then
...
eval ` tset -s -Q `
stty ...
fi

Regards!

...JRF...
Marylou Kohlmeier
Frequent Advisor

Re: stty: not a typewriter

Thank you