<?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: Shell command SU destroys script execution in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604368#M34864</link>
    <description>It's really important to write all scripts with the first line directing which interpreter to use:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;Also, when you are troubleshooting the script, add the trace capability with the command:&lt;BR /&gt;&lt;BR /&gt;set -x&lt;BR /&gt;&lt;BR /&gt;The trace lines always go to stderr so if you want to page through the output, do something like this:&lt;BR /&gt;&lt;BR /&gt;./myscript any-options 2&amp;gt;&amp;amp;1 | pg</description>
    <pubDate>Wed, 31 Oct 2001 03:48:29 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2001-10-31T03:48:29Z</dc:date>
    <item>
      <title>Shell command SU destroys script execution</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604361#M34857</link>
      <description>I have a shell script that works perfectly, the script basically kills processes based on user ID.  As I add the SU - command to the script to change to that user the script bombs.  The script uses Korn shell command like for loops etc.  The user I switch to .profile indicates the Korn shell.  I have added a part of the script below.  By the way, I cannot run one script from the other, that is SU and launch another script.  The purpose of this script is to be used in SD-UX as a preinstall script of which only one can exist.  Any help would be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;su - ecometry &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;exitval=0&lt;BR /&gt;r=`ps -e | grep exe | grep -v grep | grep -v hello.exe`&lt;BR /&gt;if [ ! "$r" = "" ]&lt;BR /&gt;then&lt;BR /&gt;s=`echo "$r" | awk '{ print $1 }'`&lt;BR /&gt;for t in $s&lt;BR /&gt;do &lt;BR /&gt;echo $t&lt;BR /&gt;echo "- PID: $t has been echoed by the user."&lt;BR /&gt;done&lt;BR /&gt;fi&lt;BR /&gt;EO</description>
      <pubDate>Tue, 30 Oct 2001 20:39:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604361#M34857</guid>
      <dc:creator>Tim Marsh_1</dc:creator>
      <dc:date>2001-10-30T20:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command SU destroys script execution</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604362#M34858</link>
      <description>Try using the -c option, i.e.&lt;BR /&gt;&lt;BR /&gt;su - ecometry -c</description>
      <pubDate>Tue, 30 Oct 2001 20:47:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604362#M34858</guid>
      <dc:creator>Craig Rants</dc:creator>
      <dc:date>2001-10-30T20:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command SU destroys script execution</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604363#M34859</link>
      <description>Hi Tim,&lt;BR /&gt;&lt;BR /&gt;There are several options:&lt;BR /&gt;1. just a check... has the user on all the systems you are planning to install the same UID and GID?&lt;BR /&gt;&lt;BR /&gt;2 put the script in the fileset execute it from configure script and remove it .&lt;BR /&gt;&lt;BR /&gt;3. put all the env settings you will need in the script PATH... etc. and exec an su command.&lt;BR /&gt;&lt;BR /&gt;Hope this will give you some options.&lt;BR /&gt;&lt;BR /&gt;Gideon</description>
      <pubDate>Tue, 30 Oct 2001 20:51:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604363#M34859</guid>
      <dc:creator>G. Vrijhoeven</dc:creator>
      <dc:date>2001-10-30T20:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command SU destroys script execution</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604364#M34860</link>
      <description>Hi Tim:&lt;BR /&gt;&lt;BR /&gt;Unless you are 'root' the 'su' command will require a password to be entered from stdin (as the controlling terminal).&lt;BR /&gt;&lt;BR /&gt;Regardless of this, add the '-c' option to your script as:&lt;BR /&gt;&lt;BR /&gt;su - ecometry -c &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;...&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF... &lt;BR /&gt;</description>
      <pubDate>Tue, 30 Oct 2001 21:06:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604364#M34860</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-10-30T21:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command SU destroys script execution</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604365#M34861</link>
      <description>I've tried the -c option with no luck. Any other ideas???</description>
      <pubDate>Tue, 30 Oct 2001 21:56:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604365#M34861</guid>
      <dc:creator>Tim Marsh_1</dc:creator>
      <dc:date>2001-10-30T21:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command SU destroys script execution</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604366#M34862</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt; Put all the contents between&lt;BR /&gt;EOF into a file  and call&lt;BR /&gt;that file through&lt;BR /&gt; su - userid -c "filename"&lt;BR /&gt;&lt;BR /&gt;Remember that the su - will&lt;BR /&gt;make the script inherit&lt;BR /&gt;the profile settings of&lt;BR /&gt;the userid .&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;raj</description>
      <pubDate>Tue, 30 Oct 2001 22:35:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604366#M34862</guid>
      <dc:creator>Roger Baptiste</dc:creator>
      <dc:date>2001-10-30T22:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command SU destroys script execution</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604367#M34863</link>
      <description>Well I have a big question. if this is a preinstall script for SDux, that is to be run by root, then why do you need to SU??&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Wed, 31 Oct 2001 03:36:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604367#M34863</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2001-10-31T03:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Shell command SU destroys script execution</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604368#M34864</link>
      <description>It's really important to write all scripts with the first line directing which interpreter to use:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;Also, when you are troubleshooting the script, add the trace capability with the command:&lt;BR /&gt;&lt;BR /&gt;set -x&lt;BR /&gt;&lt;BR /&gt;The trace lines always go to stderr so if you want to page through the output, do something like this:&lt;BR /&gt;&lt;BR /&gt;./myscript any-options 2&amp;gt;&amp;amp;1 | pg</description>
      <pubDate>Wed, 31 Oct 2001 03:48:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-command-su-destroys-script-execution/m-p/2604368#M34864</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2001-10-31T03:48:29Z</dc:date>
    </item>
  </channel>
</rss>

