1834640 Members
3372 Online
110069 Solutions
New Discussion

stty: : Not a typewriter

 
Remko Oosenbrug
Contributor

stty: : Not a typewriter

I have a script that runs in the cron. The sript works just fine but I get six times te message: stty: : Not a typewriter

I think i must set a variable in the script, but i don't know which one
OH No. It's happening again
4 REPLIES 4
federico_3
Honored Contributor

Re: stty: : Not a typewriter

Victor BERRIDGE
Honored Contributor

Re: stty: : Not a typewriter

You should test in your script if the shell is interactive:

If tty -s...

Regards
Victor
Victor BERRIDGE
Honored Contributor

Re: stty: : Not a typewriter

Look at the doc w3454520:
Problem Description

I want to know how to build an ftest to see if there
is some kind of interactive script. Can you tell me how?

Also, I'm having a problem starting a job to execute the .profile of a user.
How do I make only interactive commands execute during an interactive
shell?

Configuration Info

Operating System - HP-UX
Version -9.04
Hardware System -867S

Solution

The correct way to check if the shell is interactive (at least in ksh)
is by checking $-.

case $- in
*i*) echo interactive ;;
*) echo not interactive ;;
esac

You could test $TERM to see if it had been set. If you are running
something from cron, it would not have a value.

KEYWORD LIST
CHRIS_ANORUO
Honored Contributor

Re: stty: : Not a typewriter

Update your /etc/profile with the following lines:
case $- in

*i*) eval `ttytype -s`;;

*) eval `ttytype -s -a`;;

esac

case $TERM in
ansi| 262* |7009* | 23[89]* |264* ) TERM=hp2392a;;
ansi| vt100 | vt220 | VT100 |VT220 ) TERM=dtterm;;
esac

For the script line, e.g. su - oracle -c dbstart, it should now read su -oracle -c dbstart 2>&-

This will help.
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.