<?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 HISTFILE env variable problems in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866286#M397571</link>
    <description>Hi folks,&lt;BR /&gt;This is my 1st posting on the ITRC.&lt;BR /&gt;Here's my problem.&lt;BR /&gt;&lt;BR /&gt;All local filesystems on a single server.&lt;BR /&gt;Assume user login is fred.&lt;BR /&gt;&lt;BR /&gt;System profile /etc/profile sets and exports fred's HISTFILE=/tmp/.sh_history_fred&lt;BR /&gt;&lt;BR /&gt;When fred adds the following to their own .profile &lt;BR /&gt;&lt;BR /&gt;unset HISTFILE&lt;BR /&gt;HISTFILE=/home/fred/.sh_history_fred&lt;BR /&gt;export HISTFILE&lt;BR /&gt;&lt;BR /&gt;The HISTFILE remains as /tmp/.sh_history_fred when displaying the env after login.&lt;BR /&gt;&lt;BR /&gt;If you add an&lt;BR /&gt;echo "$HISTFILE" as the final line in the .profile it shows it set as /home/fred/.sh_history_fred&lt;BR /&gt;But as soon as login prompt is back after running .profile the HISTFILE variable is back to /tmp/.sh_history_fred &lt;BR /&gt;What's going on ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 20 Oct 2004 05:36:17 GMT</pubDate>
    <dc:creator>Gary S Taylor</dc:creator>
    <dc:date>2004-10-20T05:36:17Z</dc:date>
    <item>
      <title>HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866286#M397571</link>
      <description>Hi folks,&lt;BR /&gt;This is my 1st posting on the ITRC.&lt;BR /&gt;Here's my problem.&lt;BR /&gt;&lt;BR /&gt;All local filesystems on a single server.&lt;BR /&gt;Assume user login is fred.&lt;BR /&gt;&lt;BR /&gt;System profile /etc/profile sets and exports fred's HISTFILE=/tmp/.sh_history_fred&lt;BR /&gt;&lt;BR /&gt;When fred adds the following to their own .profile &lt;BR /&gt;&lt;BR /&gt;unset HISTFILE&lt;BR /&gt;HISTFILE=/home/fred/.sh_history_fred&lt;BR /&gt;export HISTFILE&lt;BR /&gt;&lt;BR /&gt;The HISTFILE remains as /tmp/.sh_history_fred when displaying the env after login.&lt;BR /&gt;&lt;BR /&gt;If you add an&lt;BR /&gt;echo "$HISTFILE" as the final line in the .profile it shows it set as /home/fred/.sh_history_fred&lt;BR /&gt;But as soon as login prompt is back after running .profile the HISTFILE variable is back to /tmp/.sh_history_fred &lt;BR /&gt;What's going on ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Oct 2004 05:36:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866286#M397571</guid>
      <dc:creator>Gary S Taylor</dc:creator>
      <dc:date>2004-10-20T05:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866287#M397572</link>
      <description>The old HISTFILE is not going to just go away merely by changing the variable.&lt;BR /&gt;&lt;BR /&gt;More important, its obvious that the HISTFILE is being changed elsewhere, after your change.&lt;BR /&gt;&lt;BR /&gt;You can start out with /etc/profile , and look for any source (script, program) called that might change it. Then look at .profile and see if its overriding your session.&lt;BR /&gt;&lt;BR /&gt;When I'm in a hurry I just put my logic on the last line of .profile&lt;BR /&gt;&lt;BR /&gt;Anything in .profile after the HISTFILE called with the dot space . myfile can change the setting.&lt;BR /&gt;&lt;BR /&gt;Its also possible that an application is changing the variable after .profile is running.&lt;BR /&gt;&lt;BR /&gt;You can put a set -x in .profile and get more verbose output.&lt;BR /&gt;&lt;BR /&gt;This is really a detective story, where you look until you find the culprit. Its out there, but it may be hard to find.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 20 Oct 2004 05:41:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866287#M397572</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-10-20T05:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866288#M397573</link>
      <description>Here's a full copy of my test .profile for the user:&lt;BR /&gt;&lt;BR /&gt;set -o vi&lt;BR /&gt;export HISTSIZE=9999&lt;BR /&gt;unset HISTFILE&lt;BR /&gt;HISTFILE=/home/fred/.sh_history_fred&lt;BR /&gt;export HISTFILE&lt;BR /&gt;&lt;BR /&gt;The HISTFILE still reverts back to /tmp/.sh_history_fred after .profile has run.&lt;BR /&gt;&lt;BR /&gt;Funnily enough /etc/profile exports HISTSIZE=1000&lt;BR /&gt;then the users .profile re-sets this variable to equal 9999.&lt;BR /&gt;This is changed successfully after .profile has run but still not the value of HISTFILE.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Oct 2004 07:47:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866288#M397573</guid>
      <dc:creator>Gary S Taylor</dc:creator>
      <dc:date>2004-10-20T07:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866289#M397574</link>
      <description>check the return code from the unset command.&lt;BR /&gt;See what is happeneing.&lt;BR /&gt;&lt;BR /&gt;set -o vi&lt;BR /&gt;export HISTSIZE=9999&lt;BR /&gt;unset HISTFILE&lt;BR /&gt;echo $?&lt;BR /&gt;HISTFILE=/home/fred/.sh_history_fred&lt;BR /&gt;export HISTFILE&lt;BR /&gt;&lt;BR /&gt;The HISTFILE still reverts back to /tmp/.sh_history_fred after .profile has run.&lt;BR /&gt;&lt;BR /&gt;Funnily enough /etc/profile exports HISTSIZE=1000&lt;BR /&gt;then the users .profile re-sets this variable to equal 9999.&lt;BR /&gt;This is changed successfully after .profile has run but still not the value of HISTFILE</description>
      <pubDate>Wed, 20 Oct 2004 07:58:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866289#M397574</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-10-20T07:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866290#M397575</link>
      <description>The unset command is working fine.&lt;BR /&gt;&lt;BR /&gt;After adding set -x&lt;BR /&gt;as the first line in /etc/profile and the users .profile&lt;BR /&gt;I saw the following occur:&lt;BR /&gt;+ &lt;ALL the=""&gt;&lt;BR /&gt;+ &lt;ALL the="" users="" .profile="" commands=""&gt;&lt;BR /&gt;+ &lt;THE last="" command="" in="" users="" .profile=""&gt;&lt;BR /&gt;USER=`who am i | cut -d\  -f1`&lt;BR /&gt;+ + who am i&lt;BR /&gt;+ cut -d  -f1&lt;BR /&gt;USER=fred&lt;BR /&gt;HISTFILE=/tmp/.sh_history.$USER&lt;BR /&gt;+ HISTFILE=/tmp/.sh_history.fred&lt;BR /&gt;&lt;BR /&gt;So it looks like both profiles run OK then shell jumps out and resets the HISTFILE.&lt;BR /&gt;&lt;BR /&gt;This still occurs when I remove the original HISTFILE assignment in /etc/profile and the re-assignment in the users .profile&lt;BR /&gt;&lt;BR /&gt;Very weird, any ideas ..?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/THE&gt;&lt;/ALL&gt;&lt;/ALL&gt;</description>
      <pubDate>Wed, 20 Oct 2004 09:03:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866290#M397575</guid>
      <dc:creator>Gary S Taylor</dc:creator>
      <dc:date>2004-10-20T09:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866291#M397576</link>
      <description>&lt;BR /&gt;man sh-posix shows:&lt;BR /&gt;&lt;BR /&gt;"HISTFILE&lt;BR /&gt;If this parameter is set when the shell is invoked, its value is the path name of the file that is used to store the command history."&lt;BR /&gt;&lt;BR /&gt;So you could read that to say you have but one chance. On entry and not again. Once the shell is there, setting HISTFILE will not change the actual history file because the shell is not re-invoked. If so, it is reasonable that the variable returns the actual = original history file name versus some un-used redefinition.&lt;BR /&gt;&lt;BR /&gt;Also, when experimenting with scripts to test this, be sure to 'source' them with the extra dot:  . ./test&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Oct 2004 09:27:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866291#M397576</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-10-20T09:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866292#M397577</link>
      <description>IT is good to get your first post Gary. Keep posting.&lt;BR /&gt;&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;Try on /etc/profile  file end as,&lt;BR /&gt;&lt;BR /&gt;-- /etc/profile --&lt;BR /&gt;if [[ $LOGNAME = "fred" ]]&lt;BR /&gt;then&lt;BR /&gt;set -x&lt;BR /&gt;  echo $HISTFILE&lt;BR /&gt;  export HISTFILE=/home/fred/.sh_history_fred&lt;BR /&gt; echo $HISTFILE&lt;BR /&gt;set +x&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;--- /home/fred/.profile --&lt;BR /&gt;set -x&lt;BR /&gt; echo $HISTFILE&lt;BR /&gt; export HISTFILE=/home/fred/.sh_history_real&lt;BR /&gt; echo $HISTFILE&lt;BR /&gt;set +x&lt;BR /&gt;&lt;BR /&gt;Try to login as fred and you will be notified with changes there. &lt;BR /&gt;&lt;BR /&gt;On the login, your history file will be shown as,&lt;BR /&gt;/home/fred/.sh_history_real&lt;BR /&gt;&lt;BR /&gt;Try and tell.&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Wed, 20 Oct 2004 09:28:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866292#M397577</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-10-20T09:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866293#M397578</link>
      <description>Hi Gary,&lt;BR /&gt;I think there is a long-haired explanation in Document id: 4000041319&lt;BR /&gt;&lt;BR /&gt;Try this link:&lt;BR /&gt;&lt;A href="http://www4.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000066026078" target="_blank"&gt;http://www4.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000066026078&lt;/A&gt;&lt;BR /&gt;or look for the document in the tech base.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Wed, 20 Oct 2004 09:54:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866293#M397578</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2004-10-20T09:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866294#M397579</link>
      <description>sorry,&lt;BR /&gt;forgot to mention that it suggests using "set -o nolog" in /etc/profile.&lt;BR /&gt; &lt;BR /&gt;regards again,&lt;BR /&gt;John K.</description>
      <pubDate>Wed, 20 Oct 2004 09:58:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866294#M397579</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2004-10-20T09:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866295#M397580</link>
      <description>Thanks John,&lt;BR /&gt;&lt;BR /&gt;I knew I wasn't going mad!&lt;BR /&gt;&lt;BR /&gt;Magic Answer - solved.</description>
      <pubDate>Wed, 20 Oct 2004 10:02:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866295#M397580</guid>
      <dc:creator>Gary S Taylor</dc:creator>
      <dc:date>2004-10-20T10:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: HISTFILE env variable problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866296#M397581</link>
      <description>closed</description>
      <pubDate>Wed, 20 Oct 2004 10:03:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/histfile-env-variable-problems/m-p/4866296#M397581</guid>
      <dc:creator>Gary S Taylor</dc:creator>
      <dc:date>2004-10-20T10:03:26Z</dc:date>
    </item>
  </channel>
</rss>

