<?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: Environment Variable Count in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-count/m-p/2786444#M722591</link>
    <description>The easiest way to do this would be to have a file somewhere that gets looked when the user logs in and / or runs the report.&lt;BR /&gt;&lt;BR /&gt;# cat /dir/SEQ&lt;BR /&gt;2002&lt;BR /&gt;&lt;BR /&gt;# export SEQ=`cat /dir/SEQ`&lt;BR /&gt;# echo $SEQ&lt;BR /&gt;2002&lt;BR /&gt;&lt;BR /&gt;Then when you increment SEQ you do a:&lt;BR /&gt;&lt;BR /&gt;echo $SEQ &amp;gt; /dir/SEQ&lt;BR /&gt;&lt;BR /&gt;and the new value will then be kept in the file for the next run.</description>
    <pubDate>Wed, 14 Aug 2002 23:44:26 GMT</pubDate>
    <dc:creator>Patrick Wallek</dc:creator>
    <dc:date>2002-08-14T23:44:26Z</dc:date>
    <item>
      <title>Environment Variable Count</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-count/m-p/2786443#M722590</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;What I am trying to do is set an environment variable.&lt;BR /&gt;SEQ=20000&lt;BR /&gt;This variable will change when the user runs a specific report.&lt;BR /&gt;run no 1 SEQ=20001&lt;BR /&gt;run no 2 SEQ=20002&lt;BR /&gt;&lt;BR /&gt;What I want to do is retain this new value so as next time the user logs on the sequence continues &lt;BR /&gt;SEQ=20003&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. This thread has been moved from HP-UX &amp;gt;&amp;nbsp;General to HP-UX &amp;gt; languages - HP Forums Moderator&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2012 07:08:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-count/m-p/2786443#M722590</guid>
      <dc:creator>Pascal Kouknas</dc:creator>
      <dc:date>2012-10-22T07:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Environment Variable Count</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-count/m-p/2786444#M722591</link>
      <description>The easiest way to do this would be to have a file somewhere that gets looked when the user logs in and / or runs the report.&lt;BR /&gt;&lt;BR /&gt;# cat /dir/SEQ&lt;BR /&gt;2002&lt;BR /&gt;&lt;BR /&gt;# export SEQ=`cat /dir/SEQ`&lt;BR /&gt;# echo $SEQ&lt;BR /&gt;2002&lt;BR /&gt;&lt;BR /&gt;Then when you increment SEQ you do a:&lt;BR /&gt;&lt;BR /&gt;echo $SEQ &amp;gt; /dir/SEQ&lt;BR /&gt;&lt;BR /&gt;and the new value will then be kept in the file for the next run.</description>
      <pubDate>Wed, 14 Aug 2002 23:44:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-count/m-p/2786444#M722591</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2002-08-14T23:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Environment Variable Count</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-count/m-p/2786445#M722592</link>
      <description>Pascal:&lt;BR /&gt;&lt;BR /&gt;Patrick's is good if you are keeping the sequence per user (only one copy of the script running at a time will update the file that records the sequence number).  If that is not true, you will need to come up with a solution that is better than "the last person to write the file wins".&lt;BR /&gt;&lt;BR /&gt;If so, here are two suggestions: 1) use a directory and touch a file with the sequence number in the name (be careful of how ls(1) lists numbered file names -- not necessairly in numerical order), get the last file in the list, increment the number and touch the file name (only if it does not already exist).  2) use a single file, get the last number off the bottom, increment it, append it to the file, and make sure it is not a duplicate (unfortunately, I ran out of ideas on how to deal with a duplicate -- sigh). 3) If you run your sequencing script as an LP spool script, you could use the job number...&lt;BR /&gt;&lt;BR /&gt;-dlt-</description>
      <pubDate>Thu, 15 Aug 2002 01:33:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-count/m-p/2786445#M722592</guid>
      <dc:creator>David Totsch</dc:creator>
      <dc:date>2002-08-15T01:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Environment Variable Count</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-count/m-p/2786446#M722593</link>
      <description>Hi Pascal,&lt;BR /&gt;&lt;BR /&gt;In order to make sure not to have duplicate you could use the following method :&lt;BR /&gt;&lt;BR /&gt;while :&lt;BR /&gt;do&lt;BR /&gt; mkdir /tmp/get_new_seq 1&amp;gt;/dev/null 2&amp;gt;/dev/null&lt;BR /&gt; if [ $? = 0 ]&lt;BR /&gt; then&lt;BR /&gt;  break&lt;BR /&gt; fi&lt;BR /&gt;done&lt;BR /&gt;export SEQ=`cat /dir/sequence_number`&lt;BR /&gt;let NEXTSEQ=SEQ+1&lt;BR /&gt;echo $NEXTSEQ &amp;gt; /dir/sequence_number&lt;BR /&gt;unset NEXTSEQ&lt;BR /&gt;rmdir /tmp/get_new_seq 1&amp;gt;/dev/null 2&amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;As the loop will continue until the directory is created, 2 users could not read /dir/sequence_number at the same time.&lt;BR /&gt;&lt;BR /&gt;Hope that will help.&lt;BR /&gt;&lt;BR /&gt;Christophe.</description>
      <pubDate>Thu, 15 Aug 2002 10:05:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/environment-variable-count/m-p/2786446#M722593</guid>
      <dc:creator>Christophe MAILHE</dc:creator>
      <dc:date>2002-08-15T10:05:33Z</dc:date>
    </item>
  </channel>
</rss>

