<?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 Environment variable changes in a csh script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-changes-in-a-csh-script/m-p/2702918#M58417</link>
    <description>We have database environment variables set as part of our .cshrc for a login.  When that same person changes his environment variables and runs a csh script the csh script reverts his changed environment variables back to the same that .cshrc sets.  Any ideas on this one?   Thanks all!</description>
    <pubDate>Fri, 12 Apr 2002 21:45:43 GMT</pubDate>
    <dc:creator>TD Clark</dc:creator>
    <dc:date>2002-04-12T21:45:43Z</dc:date>
    <item>
      <title>Environment variable changes in a csh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-changes-in-a-csh-script/m-p/2702918#M58417</link>
      <description>We have database environment variables set as part of our .cshrc for a login.  When that same person changes his environment variables and runs a csh script the csh script reverts his changed environment variables back to the same that .cshrc sets.  Any ideas on this one?   Thanks all!</description>
      <pubDate>Fri, 12 Apr 2002 21:45:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-changes-in-a-csh-script/m-p/2702918#M58417</guid>
      <dc:creator>TD Clark</dc:creator>
      <dc:date>2002-04-12T21:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Environment variable changes in a csh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-changes-in-a-csh-script/m-p/2702919#M58418</link>
      <description>Unless they are set in the script, when you invoke another shell it will use .cshrc.&lt;BR /&gt;&lt;BR /&gt;My .02. Been burned by this.&lt;BR /&gt;&lt;BR /&gt;Best of luck.&lt;BR /&gt;dl</description>
      <pubDate>Fri, 12 Apr 2002 22:07:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-changes-in-a-csh-script/m-p/2702919#M58418</guid>
      <dc:creator>Dave La Mar</dc:creator>
      <dc:date>2002-04-12T22:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Environment variable changes in a csh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-changes-in-a-csh-script/m-p/2702920#M58419</link>
      <description>Hi Todd:&lt;BR /&gt;&lt;BR /&gt;You need to set and export the environmental variables you want visible:&lt;BR /&gt;&lt;BR /&gt;# setenv MYTHING myvalue&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 12 Apr 2002 22:23:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-changes-in-a-csh-script/m-p/2702920#M58419</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-04-12T22:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Environment variable changes in a csh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-changes-in-a-csh-script/m-p/2702921#M58420</link>
      <description>The problem here is called inheritance. A process may inherit its environment from its parent but can pass nothing back.&lt;BR /&gt;&lt;BR /&gt;This is why you have the differences between running a shell and sourcing a shell.&lt;BR /&gt;&lt;BR /&gt;When you 'run' a shell script, a new copy of the shell is spawned and the script is run in this new spawned - ie no effect to the environment of the current shell.&lt;BR /&gt;&lt;BR /&gt;When you 'source' a shell script, it is loaded and executed in the current shell - therfore it will effect the current environment.&lt;BR /&gt;&lt;BR /&gt;For example (using /usr/bin/sh - csh is evil and shouldn't be used :-)&lt;BR /&gt;&lt;BR /&gt;$ cat env.sh&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;FRED="a value"&lt;BR /&gt;$ FRED=""&lt;BR /&gt;$ ./env.sh&lt;BR /&gt;$ echo ${FRED}&lt;BR /&gt;&lt;BR /&gt;$ . ./env.sh&lt;BR /&gt;$ echo ${FRED}&lt;BR /&gt;a value&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;It's similar in csh - except you can use the keyword 'source' instead of a . eg:&lt;BR /&gt;% source ./env.sh&lt;BR /&gt;% echo $FRED&lt;BR /&gt;a value&lt;BR /&gt;%&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;dave</description>
      <pubDate>Sat, 13 Apr 2002 06:43:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-changes-in-a-csh-script/m-p/2702921#M58420</guid>
      <dc:creator>David Lodge</dc:creator>
      <dc:date>2002-04-13T06:43:37Z</dc:date>
    </item>
  </channel>
</rss>

