<?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: Writing Variables to a File in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876652#M708017</link>
    <description>Well, I knew it was something I was doing (at least part of it).  I got the files to create but they are empty.  I can figure the rest of it out I think.  Just to make sure, is there any reason I shouldn't expect to see data in my files by doing&lt;BR /&gt;echo "$var1 $var2" &amp;gt; /newfile.txt&lt;BR /&gt;&lt;BR /&gt;My problem was my last if statement wasn't evaluating the correct variable.  Oversight on my part.</description>
    <pubDate>Wed, 22 Dec 2004 14:06:22 GMT</pubDate>
    <dc:creator>Scott Frye_1</dc:creator>
    <dc:date>2004-12-22T14:06:22Z</dc:date>
    <item>
      <title>Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876634#M707999</link>
      <description>First of all I apologize for putting a basic question out here.  Due to heay snow, I'm working from home so I don't have documentation to refer to...&lt;BR /&gt;I need to write several variables to a file.  I'm trying...&lt;BR /&gt;echo "$CPU   $TTY   $PID   $USERNAME   $PRI   $NI   $SIZE   $RES   $STATE   $TIME   $WCPU   $CPU   $COMMAND" &amp;gt; /home/sysadmin/topcpu/check_cpu.txt&lt;BR /&gt;but it is not working.  Can someone tell me what I'm doing wrong?&lt;BR /&gt;&lt;BR /&gt;Thanks to all&lt;BR /&gt;&lt;BR /&gt;Scott</description>
      <pubDate>Wed, 22 Dec 2004 10:29:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876634#M707999</guid>
      <dc:creator>Scott Frye_1</dc:creator>
      <dc:date>2004-12-22T10:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876635#M708000</link>
      <description>Does a "set" at the shell display these variables as set?&lt;BR /&gt;What kind of content do you get in the file (empty)?&lt;BR /&gt;Is this run from a script with a different environment or other variable settings?</description>
      <pubDate>Wed, 22 Dec 2004 10:38:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876635#M708000</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-12-22T10:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876636#M708001</link>
      <description>env &amp;gt; /tmp/env.txt&lt;BR /&gt;&lt;BR /&gt;You will see everything you need and then some.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 22 Dec 2004 10:40:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876636#M708001</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-12-22T10:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876637#M708002</link>
      <description>Sorry, I wasn't clear.  This is for a script I am writing.  The variables contain a line from top.  I want to write each of these variables to a file.  With this command, the file doesn't even get created.  Do I have the syntax correct?  Do I need to touch the file first?</description>
      <pubDate>Wed, 22 Dec 2004 10:44:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876637#M708002</guid>
      <dc:creator>Scott Frye_1</dc:creator>
      <dc:date>2004-12-22T10:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876638#M708003</link>
      <description>I know this sounds stupid, but does the directory "/home/sysadmin/topcpu" exist??&lt;BR /&gt;&lt;BR /&gt;ls -l /home/sysadmin/topcpu&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry d brown jr</description>
      <pubDate>Wed, 22 Dec 2004 10:53:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876638#M708003</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2004-12-22T10:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876639#M708004</link>
      <description>What exactly goes wrong? &lt;BR /&gt;Do you get an error message? &lt;BR /&gt;Or what do you find in the file if it is created at all?</description>
      <pubDate>Wed, 22 Dec 2004 10:54:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876639#M708004</guid>
      <dc:creator>Georg Tresselt</dc:creator>
      <dc:date>2004-12-22T10:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876640#M708005</link>
      <description>Hi,&lt;BR /&gt;I just tried your echo, and I get the script created  (empty line because none of the VARs have values...) so I suspect you have something wrong with the permissions on your directory, has whatever executes the script the write permission to that directory?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;All the best&lt;BR /&gt;Victor</description>
      <pubDate>Wed, 22 Dec 2004 10:55:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876640#M708005</guid>
      <dc:creator>Victor BERRIDGE</dc:creator>
      <dc:date>2004-12-22T10:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876641#M708006</link>
      <description>Has your shell the noclobber option set?&lt;BR /&gt; &lt;BR /&gt;# set -o|grep clobber&lt;BR /&gt;noclobber        off&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Dec 2004 10:55:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876641#M708006</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-12-22T10:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876642#M708007</link>
      <description>Bah, forget my silly question,&lt;BR /&gt;even if the file should at least be created.</description>
      <pubDate>Wed, 22 Dec 2004 10:57:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876642#M708007</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-12-22T10:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876643#M708008</link>
      <description>How does your script populate the variables?&lt;BR /&gt; &lt;BR /&gt;I guess you parse the top dump from something similar to&lt;BR /&gt; &lt;BR /&gt;top -d 2 -f /tmp/top.dump</description>
      <pubDate>Wed, 22 Dec 2004 11:00:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876643#M708008</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-12-22T11:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876644#M708009</link>
      <description>Here is my entire script.</description>
      <pubDate>Wed, 22 Dec 2004 11:20:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876644#M708009</guid>
      <dc:creator>Scott Frye_1</dc:creator>
      <dc:date>2004-12-22T11:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876645#M708010</link>
      <description>Is there a "&amp;gt;" missing in this line?&lt;BR /&gt;&lt;BR /&gt;top -d 1 -n 1 -f /home/sysadmin/topcpu/topck.txt</description>
      <pubDate>Wed, 22 Dec 2004 11:27:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876645#M708010</guid>
      <dc:creator>Georg Tresselt</dc:creator>
      <dc:date>2004-12-22T11:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876646#M708011</link>
      <description>It's not the old shell can't deal with floating point numbers in comparisons malarky again is it?</description>
      <pubDate>Wed, 22 Dec 2004 11:41:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876646#M708011</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2004-12-22T11:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876647#M708012</link>
      <description>OK, I think I may have found part of your issue.&lt;BR /&gt;&lt;BR /&gt;In your script you read in a command into the variable COMM.&lt;BR /&gt;&lt;BR /&gt;However you use the variable COMMAND rather than COMM in several places, including an IF statement.  Fix that and you might see a bit of progress.</description>
      <pubDate>Wed, 22 Dec 2004 11:56:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876647#M708012</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2004-12-22T11:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876648#M708013</link>
      <description>Does any of your if tests, in whose body you write to check_cpu.txt, ever evaluate to true?&lt;BR /&gt; &lt;BR /&gt;Stupid question, but have you tried to run your script with the shell's poor man's debugger "sh -x"?</description>
      <pubDate>Wed, 22 Dec 2004 12:13:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876648#M708013</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-12-22T12:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876649#M708014</link>
      <description>Off topic, where do you get the heavy snow?&lt;BR /&gt;(I hope not on your screen ;-)&lt;BR /&gt;So at least one of us is heaving a white Xmas.</description>
      <pubDate>Wed, 22 Dec 2004 12:16:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876649#M708014</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-12-22T12:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876650#M708015</link>
      <description>Snow is in Indianapolis IN.&lt;BR /&gt;&lt;BR /&gt;I've got a lot of replies to look into.  I'll assign points accordingly.</description>
      <pubDate>Wed, 22 Dec 2004 13:45:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876650#M708015</guid>
      <dc:creator>Scott Frye_1</dc:creator>
      <dc:date>2004-12-22T13:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876651#M708016</link>
      <description>OK, to follow up with a few things...&lt;BR /&gt;Yes /home/sysadmin/topcpu exists&lt;BR /&gt;&lt;BR /&gt;Permissions are set as root, running script as root.&lt;BR /&gt;&lt;BR /&gt;Changed COMMAND to COMM, still doesn't create files.&lt;BR /&gt;&lt;BR /&gt;And yes, some of my if statements do evalutate to true.&lt;BR /&gt;&lt;BR /&gt;Seems like this should be so easy, I don't know why I can't get these files to create.  I'm sure I've missed something.</description>
      <pubDate>Wed, 22 Dec 2004 14:01:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876651#M708016</guid>
      <dc:creator>Scott Frye_1</dc:creator>
      <dc:date>2004-12-22T14:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876652#M708017</link>
      <description>Well, I knew it was something I was doing (at least part of it).  I got the files to create but they are empty.  I can figure the rest of it out I think.  Just to make sure, is there any reason I shouldn't expect to see data in my files by doing&lt;BR /&gt;echo "$var1 $var2" &amp;gt; /newfile.txt&lt;BR /&gt;&lt;BR /&gt;My problem was my last if statement wasn't evaluating the correct variable.  Oversight on my part.</description>
      <pubDate>Wed, 22 Dec 2004 14:06:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876652#M708017</guid>
      <dc:creator>Scott Frye_1</dc:creator>
      <dc:date>2004-12-22T14:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Variables to a File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876653#M708018</link>
      <description>OK, how about doing this for us and posting the results:&lt;BR /&gt;&lt;BR /&gt;# sh -x scriptname&lt;BR /&gt;&lt;BR /&gt;Or just put&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh -x&lt;BR /&gt;&lt;BR /&gt;at the top of the script, execute it and attach the results.  Maybe the trace will give us some more clues.</description>
      <pubDate>Wed, 22 Dec 2004 14:06:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/writing-variables-to-a-file/m-p/4876653#M708018</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2004-12-22T14:06:25Z</dc:date>
    </item>
  </channel>
</rss>

