<?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: How to pass a name through a variable. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112516#M149080</link>
    <description>Firstly, you can do this in one step:&lt;BR /&gt;export NAME=Robert BUT that is still not going to do what I think you are trying to do. You seem to be trying to export a variable in a child process to a parent. That will never work because the parent never inherits from the child.&lt;BR /&gt;&lt;BR /&gt;What you can do is pass the data through a temporary file or use the "." (dot) to include the script so that it actually runs in the foreground.&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;export NAME=Robert&lt;BR /&gt;save this (along with anything else) in a file (e.g. /usr/local/bin/myscript.sh)&lt;BR /&gt;&lt;BR /&gt;Now from your main script simply&lt;BR /&gt;. /usr/local/bin/myscript.sh&lt;BR /&gt; &lt;BR /&gt;That will fix you BUT myscript.sh must not contain an exit or return statement because that will have the effect of exiting the foreground process (since they are now one and the same).&lt;BR /&gt;</description>
    <pubDate>Thu, 06 Nov 2003 12:12:48 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2003-11-06T12:12:48Z</dc:date>
    <item>
      <title>How to pass a name through a variable.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112512#M149076</link>
      <description>Good morning all.&lt;BR /&gt;&lt;BR /&gt;I'm trying to pass a name through a variable for example.&lt;BR /&gt;&lt;BR /&gt;NAME=Robert; export NAME&lt;BR /&gt;&lt;BR /&gt;If I do this from the command line is not a problem, but if I try to pass this in a script, I get the following message. "The parameter is not set" when I recall the variable with the echo command "echo $NAME".&lt;BR /&gt;This should be simple, but for some reason I can not make it work. If you can help me, I will really appreciated because I need to pass a few. I will give points to the answers.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;&lt;BR /&gt;RT.</description>
      <pubDate>Thu, 06 Nov 2003 12:03:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112512#M149076</guid>
      <dc:creator>Reynaldo Torres</dc:creator>
      <dc:date>2003-11-06T12:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a name through a variable.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112513#M149077</link>
      <description>Hi Reynaldo,&lt;BR /&gt;&lt;BR /&gt;can you post us, how you do it now?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Nov 2003 12:09:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112513#M149077</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-11-06T12:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a name through a variable.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112514#M149078</link>
      <description>In shell scripting you can pass variables on the command line as follows&lt;BR /&gt;&lt;BR /&gt;newscriptname $NAME&lt;BR /&gt;&lt;BR /&gt;The value in $NAME will be available to the new script as $1&lt;BR /&gt;&lt;BR /&gt;It can then be transferred to any variable you need as follows:&lt;BR /&gt;&lt;BR /&gt;NAME=$1&lt;BR /&gt;export NAME&lt;BR /&gt;&lt;BR /&gt;The script will then be able to use it any way it needs.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 06 Nov 2003 12:09:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112514#M149078</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-11-06T12:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a name through a variable.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112515#M149079</link>
      <description>RT -&lt;BR /&gt;export NAME=Robert&lt;BR /&gt;echo $NAME&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;dl</description>
      <pubDate>Thu, 06 Nov 2003 12:09:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112515#M149079</guid>
      <dc:creator>Dave La Mar</dc:creator>
      <dc:date>2003-11-06T12:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a name through a variable.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112516#M149080</link>
      <description>Firstly, you can do this in one step:&lt;BR /&gt;export NAME=Robert BUT that is still not going to do what I think you are trying to do. You seem to be trying to export a variable in a child process to a parent. That will never work because the parent never inherits from the child.&lt;BR /&gt;&lt;BR /&gt;What you can do is pass the data through a temporary file or use the "." (dot) to include the script so that it actually runs in the foreground.&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;export NAME=Robert&lt;BR /&gt;save this (along with anything else) in a file (e.g. /usr/local/bin/myscript.sh)&lt;BR /&gt;&lt;BR /&gt;Now from your main script simply&lt;BR /&gt;. /usr/local/bin/myscript.sh&lt;BR /&gt; &lt;BR /&gt;That will fix you BUT myscript.sh must not contain an exit or return statement because that will have the effect of exiting the foreground process (since they are now one and the same).&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Nov 2003 12:12:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112516#M149080</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-11-06T12:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a name through a variable.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112517#M149081</link>
      <description>Here is what is happening...&lt;BR /&gt;&lt;BR /&gt;When you are running your script, the variable gets defined in a subshell, which is then not available in the original shell.&lt;BR /&gt;&lt;BR /&gt;If you source the script, it will get run in the current shell, and the variable will be defined.&lt;BR /&gt;&lt;BR /&gt;for example, the script I have named t, defines name=fred and exports it.&lt;BR /&gt;&lt;BR /&gt;# cat t&lt;BR /&gt;name=fred&lt;BR /&gt;export name&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;from the command line I define name=john, export it, then echo it.&lt;BR /&gt;&lt;BR /&gt;# name=john&lt;BR /&gt;# export name&lt;BR /&gt;# echo $name&lt;BR /&gt;john&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;If I run the script in a subshell, name in the current shell remains = john.&lt;BR /&gt;&lt;BR /&gt;# ./t&lt;BR /&gt;# echo $name&lt;BR /&gt;john&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;If I run the script in the current shell, name will be changed.&lt;BR /&gt;&lt;BR /&gt;# . ./t&lt;BR /&gt;# echo $name&lt;BR /&gt;fred&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; - John</description>
      <pubDate>Thu, 06 Nov 2003 12:19:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112517#M149081</guid>
      <dc:creator>John Kittel</dc:creator>
      <dc:date>2003-11-06T12:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a name through a variable.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112518#M149082</link>
      <description>Clay has given a clear picture.&lt;BR /&gt;&lt;BR /&gt;You can put all the variables inside a script that you want to export and source the same to the shell.  It will be available for that shell. For that&lt;BR /&gt;. ./&amp;lt;script_having_vars&amp;gt;.sh&lt;BR /&gt;&lt;BR /&gt;You can pass arguments to a shell script also which will be assigned to $1 ... $n depending on the number of args you pass.&lt;BR /&gt;HTH,&lt;BR /&gt;Umapathy&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Nov 2003 12:21:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-pass-a-name-through-a-variable/m-p/3112518#M149082</guid>
      <dc:creator>Umapathy S</dc:creator>
      <dc:date>2003-11-06T12:21:58Z</dc:date>
    </item>
  </channel>
</rss>

