<?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: Something about shell scripting. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579400#M924082</link>
    <description>So you means that I can not pass exported variables after I use the su - command?? But why the same scripts in my other machines will work?? Do you have any clue about this??&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
    <pubDate>Fri, 14 Sep 2001 08:34:49 GMT</pubDate>
    <dc:creator>Kenny Chau</dc:creator>
    <dc:date>2001-09-14T08:34:49Z</dc:date>
    <item>
      <title>Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579393#M924075</link>
      <description>Hi, I had a script to export some useful variable for other script to run. However, when I used "su - $account -c "script" " to run some scripts, the exported variable had gone. How to retain the export variable after I used "su - $account -c "script" " on other scripts?&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Fri, 14 Sep 2001 03:37:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579393#M924075</guid>
      <dc:creator>Kenny Chau</dc:creator>
      <dc:date>2001-09-14T03:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579394#M924076</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The "script" should be a absolute path of your environment variable script and NOT a variable because it cannot pass through to a 'su -c' command.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Patrick</description>
      <pubDate>Fri, 14 Sep 2001 03:51:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579394#M924076</guid>
      <dc:creator>Patrick Chim</dc:creator>
      <dc:date>2001-09-14T03:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579395#M924077</link>
      <description>Thanks for your reply. I had tried this in other machines (L4000) and it is succeeded. However, when I put the same script in the A400 machine, it did not work. Do you have any clue?</description>
      <pubDate>Fri, 14 Sep 2001 03:54:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579395#M924077</guid>
      <dc:creator>Kenny Chau</dc:creator>
      <dc:date>2001-09-14T03:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579396#M924078</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;what you could do is writing your variables into a file before su-ing.&lt;BR /&gt;&lt;BR /&gt;echo "export VAR='$VAR'" &amp;gt;/tmp/set_variables&lt;BR /&gt;echo "export VAR1='$VAR1'" &amp;gt;&amp;gt;/tmp/set_variables&lt;BR /&gt;and so on ...&lt;BR /&gt;chown $account /tmp/set_variables&lt;BR /&gt;&lt;BR /&gt;Then in the script of $account add the line&lt;BR /&gt;. /tmp/set_variables&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
      <pubDate>Fri, 14 Sep 2001 06:19:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579396#M924078</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2001-09-14T06:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579397#M924079</link>
      <description>Thanks Andreas, I know it is worked. However, I'm just wondering why the same scripts work in other machines but not the one that I am using. Same scripts, same variable files but work on other machines. Do you know anything that I had missed for this?&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Fri, 14 Sep 2001 06:23:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579397#M924079</guid>
      <dc:creator>Kenny Chau</dc:creator>
      <dc:date>2001-09-14T06:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579398#M924080</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I think it's the shell problem because I encounter it before. Sometime you call a ksh script but it internal call another sh script will cause you not to get any environment variable which specific in the sh script.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Patrick</description>
      <pubDate>Fri, 14 Sep 2001 06:36:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579398#M924080</guid>
      <dc:creator>Patrick Chim</dc:creator>
      <dc:date>2001-09-14T06:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579399#M924081</link>
      <description>It is not very problable that using a su -command will pass exported variables.&lt;BR /&gt;&lt;BR /&gt;See inside your .profile files, and other involved files such as $HOME/.chsrc, .kshrc and /etc/profile for that variables.</description>
      <pubDate>Fri, 14 Sep 2001 08:00:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579399#M924081</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2001-09-14T08:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579400#M924082</link>
      <description>So you means that I can not pass exported variables after I use the su - command?? But why the same scripts in my other machines will work?? Do you have any clue about this??&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Fri, 14 Sep 2001 08:34:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579400#M924082</guid>
      <dc:creator>Kenny Chau</dc:creator>
      <dc:date>2001-09-14T08:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579401#M924083</link>
      <description>I mean that these suposed exported variables are set in the user environment, not from original shell.&lt;BR /&gt;&lt;BR /&gt;Create a file /tmp/jj&lt;BR /&gt;&lt;BR /&gt;echo JJ="-"$JJ"-"&lt;BR /&gt;&lt;BR /&gt;export JJ in the original shell&lt;BR /&gt;JJ="OK"&lt;BR /&gt;export JJ&lt;BR /&gt;&lt;BR /&gt;and now &lt;BR /&gt;&lt;BR /&gt;su - user -c "/tmp/jj"....&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Sep 2001 08:44:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579401#M924083</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2001-09-14T08:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579402#M924084</link>
      <description>Hello Kenny,&lt;BR /&gt;&lt;BR /&gt;since only a process can modify its own environment,&lt;BR /&gt;you could do something like:&lt;BR /&gt;&lt;BR /&gt;su - USER -c "ENV=$HOME/.special-vars sh "&lt;BR /&gt;&lt;BR /&gt;where "$HOME/.sprecial-vars" would be shell-script&lt;BR /&gt;(with permissions "r" and "x") containing all the&lt;BR /&gt;"export" statements and variable assignments you&lt;BR /&gt;need...&lt;BR /&gt;Since Korn-Shell and POSIX-Shell both do execute the&lt;BR /&gt;script referred to in "ENV" before showing the prompt,&lt;BR /&gt;that would do what yout want.&lt;BR /&gt;&lt;BR /&gt;OR, you may have a line in your "$HOME/.profile" like&lt;BR /&gt;this:&lt;BR /&gt;&lt;BR /&gt;if [ -r $HOME/.variables ]; then . $HOME/.variables; fi&lt;BR /&gt;&lt;BR /&gt;Hence, if there is a script ".variables" it will be sourced&lt;BR /&gt;into your login shells (and "su -", too). Then you will just &lt;BR /&gt;have to create or modify that script...&lt;BR /&gt;&lt;BR /&gt;Just my ?0.02,&lt;BR /&gt;Wodisch</description>
      <pubDate>Fri, 14 Sep 2001 19:31:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579402#M924084</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2001-09-14T19:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579403#M924085</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;at least on Linux there are two slightly different ways to submit the su command: &lt;BR /&gt;&lt;BR /&gt;su $account&lt;BR /&gt;or&lt;BR /&gt;su - $account&lt;BR /&gt;&lt;BR /&gt;The difference is that with "-" (means login) there will be a completely new environment whereas without the old environment will be used. I tried that:&lt;BR /&gt;&lt;BR /&gt;tboerner@N01049LUX:~/Download &amp;gt; export MY_TEST_VARIABLE="Some dummy value"&lt;BR /&gt;tboerner@N01049LUX:~/Download &amp;gt; echo $MY_TEST_VARIABLE &lt;BR /&gt;Some dummy value&lt;BR /&gt;tboerner@N01049LUX:~/Download &amp;gt; su - tb&lt;BR /&gt;Password: &lt;BR /&gt;&lt;BR /&gt;tb@N01049LUX:~ &amp;gt;  echo $MY_TEST_VARIABLE &lt;BR /&gt;&lt;BR /&gt;tb@N01049LUX:~ &amp;gt; logout&lt;BR /&gt;tboerner@N01049LUX:~/Download &amp;gt;  echo $MY_TEST_VARIABLE &lt;BR /&gt;Some dummy value&lt;BR /&gt;tboerner@N01049LUX:~/Download &amp;gt; su tb&lt;BR /&gt;Password: &lt;BR /&gt;tb@N01049LUX:/home/nokia/Download &amp;gt;  echo $MY_TEST_VARIABLE &lt;BR /&gt;Some dummy value&lt;BR /&gt;tb@N01049LUX:/home/nokia/Download &amp;gt; exit&lt;BR /&gt;tboerner@N01049LUX:~/Download &amp;gt;  echo $MY_TEST_VARIABLE &lt;BR /&gt;Some dummy value&lt;BR /&gt;&lt;BR /&gt;Hope that helps a bit to explain your question.&lt;BR /&gt;Have a nice day</description>
      <pubDate>Mon, 17 Sep 2001 07:03:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579403#M924085</guid>
      <dc:creator>Thomas Boerner_1</dc:creator>
      <dc:date>2001-09-17T07:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579404#M924086</link>
      <description>Kenny sed: "So you means that I can not pass exported variables after I use the                            su - command?? But why the same scripts in my other machines will                                          work?? Do you have any clue about this??"&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;Kenny, apparently on the machines where things work, the environmental vars you need are being set globally at the start of each user shell (like from /etc/profile).  Compare the /etc/profiles from a system where things work and from a system where things are broken, and you'll probably see what's happening.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Sep 2001 13:53:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579404#M924086</guid>
      <dc:creator>W.C. Epperson</dc:creator>
      <dc:date>2001-09-17T13:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Something about shell scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579405#M924087</link>
      <description>&lt;BR /&gt;I agree with Thomas, there is a difference wether you are using the "-" or not.&lt;BR /&gt;This is clearly documented on the man page of su. Unfortunately su has been withdrawn from the XPG and POSIX standards. That could explain diverging implementations on different OS. There is no difference between HPUX10 and HPUX11 with respect to the su man page.&lt;BR /&gt;&lt;BR /&gt;Klaus</description>
      <pubDate>Tue, 18 Sep 2001 09:24:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/something-about-shell-scripting/m-p/2579405#M924087</guid>
      <dc:creator>Klaus Crusius</dc:creator>
      <dc:date>2001-09-18T09:24:50Z</dc:date>
    </item>
  </channel>
</rss>

