<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: stty: : Unknown error in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478178#M212927</link>
    <description>Patrick:&lt;BR /&gt;&lt;BR /&gt;Interesting.  I thought I was just capturing what was being sent to the terminal.&lt;BR /&gt;&lt;BR /&gt;So two follow up questions then:&lt;BR /&gt;&lt;BR /&gt;1) How, within a script, can I get a copy of what is happening when I execute the commands within the script, without having to be at a terminal?&lt;BR /&gt;&lt;BR /&gt;2) How do I maintain the su'd user's profile through the execution of the remainder of the script / commands?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Jeff</description>
    <pubDate>Fri, 04 Feb 2005 08:28:16 GMT</pubDate>
    <dc:creator>Jeff Crump</dc:creator>
    <dc:date>2005-02-04T08:28:16Z</dc:date>
    <item>
      <title>stty: : Unknown error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478173#M212922</link>
      <description>I am using a change management system that allows host-based commands and scripts be called when a file is transferred to a directory location (the commands or script get called).&lt;BR /&gt;&lt;BR /&gt;I am issuing the following commands:&lt;BR /&gt;&lt;BR /&gt;whoami &amp;gt; /home/prandall/cmndslog.txt 2&amp;gt;&amp;amp;1&lt;BR /&gt;su - prandall &amp;gt;&amp;gt; /home/prandall/cmndslog.txt 2&amp;gt;&amp;amp;1&lt;BR /&gt;echo $SHELL &amp;gt;&amp;gt; /home/prandall/cmndslog.txt 2&amp;gt;&amp;amp;1&lt;BR /&gt;uname -a &amp;gt;&amp;gt; /home/prandall/cmndslog.txt 2&amp;gt;&amp;amp;1&lt;BR /&gt;whoami &amp;gt;&amp;gt; /home/prandall/cmndslog.txt 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;In the log file I see the following results (the HP system may wrap where the oringal results didn't):&lt;BR /&gt;&lt;BR /&gt;root&lt;BR /&gt;stty: : Unknown error&lt;BR /&gt;(c)Copyright 1983-2000 Hewlett-Packard Co.,  All Rights Reserved.&lt;BR /&gt;(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California&lt;BR /&gt;(c)Copyright 1980, 1984, 1986 Novell, Inc.&lt;BR /&gt;(c)Copyright 1986-1992 Sun Microsystems, Inc.&lt;BR /&gt;(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology&lt;BR /&gt;(c)Copyright 1989-1993  The Open Software Foundation, Inc.&lt;BR /&gt;(c)Copyright 1986 Digital Equipment Corp.&lt;BR /&gt;(c)Copyright 1990 Motorola, Inc.&lt;BR /&gt;(c)Copyright 1990, 1991, 1992 Cornell University&lt;BR /&gt;(c)Copyright 1989-1991 The University of Maryland&lt;BR /&gt;(c)Copyright 1988 Carnegie Mellon University&lt;BR /&gt;(c)Copyright 1991-2000 Mentat Inc.&lt;BR /&gt;(c)Copyright 1996 Morning Star Technologies, Inc.&lt;BR /&gt;(c)Copyright 1996 Progressive Systems, Inc.&lt;BR /&gt;(c)Copyright 1991-2000 Isogon Corporation, All Rights Reserved.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      RESTRICTED RIGHTS LEGEND&lt;BR /&gt;Use, duplication, or disclosure by the U.S. Government is subject to&lt;BR /&gt;restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in&lt;BR /&gt;Technical Data and Computer Software clause in DFARS 252.227-7013.&lt;BR /&gt;&lt;BR /&gt;                           Hewlett-Packard Company&lt;BR /&gt;                           3000 Hanover Street&lt;BR /&gt;                           Palo Alto, CA 94304 U.S.A.&lt;BR /&gt;&lt;BR /&gt;Rights for non-DOD U.S. Government Departments and Agencies are as set&lt;BR /&gt;forth in FAR 52.227-19(c)(1,2).&lt;BR /&gt;You have mail.&lt;BR /&gt;Not a terminal&lt;BR /&gt;stty: : Unknown error&lt;BR /&gt;stty: : Unknown error&lt;BR /&gt;&lt;BR /&gt; 3&lt;BR /&gt;         1         1         1         1         1         1         1         1         1&lt;BR /&gt;logout&lt;BR /&gt;/sbin/sh&lt;BR /&gt;HP-UX hp9001 B.11.11 U 9000/800 3056282497 unlimited-user license&lt;BR /&gt;root&lt;BR /&gt;&lt;BR /&gt;It appears that the su is attempted but then I get some stty errors, funny characters, and the logout.&lt;BR /&gt;&lt;BR /&gt;Can anyone provide some assistance on why I am gettnig the stty errors?  If so, how do I resolve them?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Jeff</description>
      <pubDate>Thu, 03 Feb 2005 17:32:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478173#M212922</guid>
      <dc:creator>Jeff Crump</dc:creator>
      <dc:date>2005-02-03T17:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: stty: : Unknown error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478174#M212923</link>
      <description>Hi Jeff,&lt;BR /&gt;&lt;BR /&gt;The .profile of user "prandall" needs to be checked. Since you are calling from a script the message "Not a terminal" is correct.&lt;BR /&gt;&lt;BR /&gt;There may be some customisations in the .profile which is causing this error.&lt;BR /&gt;&lt;BR /&gt;You can also check the forum for Bill Hassell's many reply on this issue. On more than 1 occasion he had explained about stty settings within a script, which I found very useful.&lt;BR /&gt;&lt;BR /&gt;With regards,&lt;BR /&gt;Mohan.</description>
      <pubDate>Thu, 03 Feb 2005 18:04:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478174#M212923</guid>
      <dc:creator>Mohanasundaram_1</dc:creator>
      <dc:date>2005-02-03T18:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: stty: : Unknown error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478175#M212924</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;include &lt;BR /&gt;&lt;BR /&gt;export TERM=vt100 in your /etc/profile and .profile of user&lt;BR /&gt;&lt;BR /&gt;regds,&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Feb 2005 22:30:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478175#M212924</guid>
      <dc:creator>bhavin asokan</dc:creator>
      <dc:date>2005-02-03T22:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: stty: : Unknown error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478176#M212925</link>
      <description>You are doing the 'su - prandall' and redirecting the output to a file.  That is the reason you are getting the stty error.  It is expecting you to be at a terminal of some sort when doing an su.&lt;BR /&gt;&lt;BR /&gt;Also, the 'su - prandall' will be closed when you go to the next step in the script.  It won't do the 'echo $SHELL' within the prandall session, which can be seen by the "logout" message before the /sbin/sh in the output you pasted.</description>
      <pubDate>Thu, 03 Feb 2005 22:35:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478176#M212925</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2005-02-03T22:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: stty: : Unknown error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478177#M212926</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;su - prandall &amp;gt;&amp;gt; /home/prandall/cmndslog.txt 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;The message with su command.You can check prandall user's .login or .profile files and&lt;BR /&gt;Modify about tset and stty.&lt;BR /&gt;&lt;BR /&gt;like this (csh)&lt;BR /&gt;eval `tset -s -Q -m ':vt100' `&lt;BR /&gt;stty erase "^H" kill "^U" intr "^C" eof "^D" susp "^Z" hupcl ixon ixoff tostop&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Ref-URL:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=72142" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=72142&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2005 01:15:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478177#M212926</guid>
      <dc:creator>Y.J.JIN</dc:creator>
      <dc:date>2005-02-04T01:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: stty: : Unknown error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478178#M212927</link>
      <description>Patrick:&lt;BR /&gt;&lt;BR /&gt;Interesting.  I thought I was just capturing what was being sent to the terminal.&lt;BR /&gt;&lt;BR /&gt;So two follow up questions then:&lt;BR /&gt;&lt;BR /&gt;1) How, within a script, can I get a copy of what is happening when I execute the commands within the script, without having to be at a terminal?&lt;BR /&gt;&lt;BR /&gt;2) How do I maintain the su'd user's profile through the execution of the remainder of the script / commands?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Jeff</description>
      <pubDate>Fri, 04 Feb 2005 08:28:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478178#M212927</guid>
      <dc:creator>Jeff Crump</dc:creator>
      <dc:date>2005-02-04T08:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: stty: : Unknown error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478179#M212928</link>
      <description>Let's see if I can help here. First, when you use su - in a script, your script does indeed login and execute all the profiles (/etc/profile and .profile and any related profile/setup scripts). BUT it is not interactive--there is no terminal associated with the script, so anything that tries to set something on the terminal (tput, tabs, tset, ttytype, stty, etc) will fail, complaining about "not a typewriter". That is exactly as expected but probably not what is desired. So, to eliminate these messages, you need to skip terminal commands whenever the script is run in batch mode (ie, cron or at jobs). Here is an example:&lt;BR /&gt; &lt;BR /&gt;if tty -s&lt;BR /&gt;then&lt;BR /&gt;tabs&lt;BR /&gt;fi&lt;BR /&gt; &lt;BR /&gt;or in a simplified form for a single command:&lt;BR /&gt; &lt;BR /&gt;[ tty -s ] &amp;amp;&amp;amp; stty erase "^H" kill "^U" intr "^C"&lt;BR /&gt; &lt;BR /&gt;This same technique (if tty -s) must be used in .profile since it has some terminal commands too. Start by rewriting /etc/profile (some other suggestions are here too):&lt;BR /&gt; &lt;BR /&gt;1. Replace:&lt;BR /&gt; &lt;BR /&gt;cat /etc/copyright&lt;BR /&gt; &lt;BR /&gt;with:&lt;BR /&gt; &lt;BR /&gt;if [ tty -s ] &amp;amp;&amp;amp; echo "The copyright notice can be read by typing:  cat /etc/copyright"&lt;BR /&gt; &lt;BR /&gt;(users will appreciate the reduction of login junk on the screen and your logfile will no longer have all that copyright stuff in it)&lt;BR /&gt; &lt;BR /&gt;2. Replace *ALL* of this code:&lt;BR /&gt;# set term if it's not set&lt;BR /&gt;if [ "$TERM" = "" -o "$TERM" = "unknown" \&lt;BR /&gt;-o "$TERM" = "dialup" -o "$TERM" = "network" ]&lt;BR /&gt;then&lt;BR /&gt;eval `ttytype -s -a`&lt;BR /&gt;fi&lt;BR /&gt;export TERM&lt;BR /&gt;# set erase to ^H, if ERASE is not set&lt;BR /&gt;if [ "$ERASE" = "" ]&lt;BR /&gt;then&lt;BR /&gt;ERASE="^H"&lt;BR /&gt;export ERASE&lt;BR /&gt;fi&lt;BR /&gt;stty erase $ERASE &lt;BR /&gt; &lt;BR /&gt;with:&lt;BR /&gt; &lt;BR /&gt;if [ tty -s ]&lt;BR /&gt;then&lt;BR /&gt;eval $(ttytype -s)&lt;BR /&gt;sbin/stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixon ixoff&lt;BR /&gt; &lt;BR /&gt;(NOTE: the use of tset is defintely not recommended--use ttytype in all profiles)  &lt;BR /&gt; &lt;BR /&gt;Now, to see every step of a script run in batch mode, the universal way (whether bacth or interactive) is to first exec the script with new I/O and then turn on tracing as in:&lt;BR /&gt; &lt;BR /&gt;exec &amp;gt; /home/prandall/cmndslog.txt 2&amp;gt;&amp;amp;1&lt;BR /&gt;set -x&lt;BR /&gt; &lt;BR /&gt;Now the script will send all output to the file in /var/tmp. &lt;BR /&gt; &lt;BR /&gt;As far as maintaining the login environment, you change your execution to:&lt;BR /&gt; &lt;BR /&gt;su - prandall -c /usr/bin/sh /home/prandall/myscript&lt;BR /&gt; &lt;BR /&gt;and you put all your commands to be run as prandall into myscript. The key is that su starts a shell which lasts as long as the shell has something to do, ie, -c myscript.</description>
      <pubDate>Fri, 18 Mar 2005 09:28:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stty-unknown-error/m-p/3478179#M212928</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2005-03-18T09:28:35Z</dc:date>
    </item>
  </channel>
</rss>

