<?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: shell script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813895#M641602</link>
    <description>&lt;P&gt;if [ $ca -gt $pa ]&lt;BR /&gt;&amp;nbsp;then&lt;BR /&gt;echo $ca&lt;BR /&gt;&amp;nbsp;elif [ $pa -gt $ca ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;then&lt;BR /&gt;echo $pa&lt;BR /&gt;&amp;nbsp;else&lt;BR /&gt;echo "They are equal"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;(Sorry Hakki) :-)&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jul 2011 11:48:29 GMT</pubDate>
    <dc:creator>V. Nyga</dc:creator>
    <dc:date>2011-07-05T11:48:29Z</dc:date>
    <item>
      <title>shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813783#M641600</link>
      <description>&lt;P&gt;i want to compare two values in shell script .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example-&lt;/P&gt;&lt;P&gt;ca=50&lt;/P&gt;&lt;P&gt;pa=45&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if [ $ca -&lt;STRONG&gt;gt&lt;/STRONG&gt;&amp;nbsp;$pa ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need output&amp;nbsp;greater value . how to print the vaule after the if statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2011 10:21:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813783#M641600</guid>
      <dc:creator>1a</dc:creator>
      <dc:date>2011-07-05T10:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813823#M641601</link>
      <description>&lt;P&gt;&amp;nbsp;if [ $ca -gt $pa ]&lt;BR /&gt;&amp;nbsp;then&lt;BR /&gt;echo $ca&lt;BR /&gt;fi&lt;BR /&gt;﻿&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2011 10:46:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813823#M641601</guid>
      <dc:creator>Hakki Aydin Ucar</dc:creator>
      <dc:date>2011-07-05T10:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813895#M641602</link>
      <description>&lt;P&gt;if [ $ca -gt $pa ]&lt;BR /&gt;&amp;nbsp;then&lt;BR /&gt;echo $ca&lt;BR /&gt;&amp;nbsp;elif [ $pa -gt $ca ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;then&lt;BR /&gt;echo $pa&lt;BR /&gt;&amp;nbsp;else&lt;BR /&gt;echo "They are equal"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;(Sorry Hakki) :-)&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2011 11:48:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813895#M641602</guid>
      <dc:creator>V. Nyga</dc:creator>
      <dc:date>2011-07-05T11:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813901#M641603</link>
      <description>&lt;P&gt;Danke ! :smileyvery-happy:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I missed the half part of code..&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2011 11:49:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813901#M641603</guid>
      <dc:creator>Hakki Aydin Ucar</dc:creator>
      <dc:date>2011-07-05T11:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813913#M641604</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you only want the greater value, or if they are equal, merely that value, you could use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# [ ${ca} -gt ${pa} ] &amp;amp;&amp;amp; echo ${ca} || echo ${pa}&lt;BR /&gt;﻿&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...JRF...&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2011 11:58:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4813913#M641604</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-07-05T11:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4814227#M641605</link>
      <description>&lt;P&gt;If you are using a real shell you can use C style expressions:&lt;/P&gt;&lt;P&gt;if (( ca &amp;gt; pa )); then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $ca&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $pa&lt;/P&gt;&lt;P&gt;fi&lt;/P&gt;&lt;P&gt;This prints the maximum of the two.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2011 15:18:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4814227#M641605</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-07-05T15:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4815673#M641606</link>
      <description>&lt;P&gt;hi every one thanks for you reply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dennis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i user your script , it working fine . please tell how to print the greater value in one text file&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2011 14:25:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4815673#M641606</guid>
      <dc:creator>1a</dc:creator>
      <dc:date>2011-07-06T14:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4815685#M641607</link>
      <description>Sorry dennis,&lt;BR /&gt;&lt;BR /&gt;i use your script , it is working fine. please tell how to print the greater value in one text file&lt;BR /&gt;&lt;BR /&gt;because i need output value through mail, so i plan to send mailx command.</description>
      <pubDate>Wed, 06 Jul 2011 14:27:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4815685#M641607</guid>
      <dc:creator>1a</dc:creator>
      <dc:date>2011-07-06T14:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4815857#M641608</link>
      <description>&lt;P&gt;Starting with Dennis' script, and noting that nothing will print if the values are equal, this might work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (( ca &amp;gt; pa )); then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $ca&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $pa&lt;/P&gt;&lt;P&gt;fi&amp;nbsp;&amp;nbsp; &amp;gt;&amp;nbsp; max.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;mailx&amp;nbsp; -s&amp;nbsp; "max values"&amp;nbsp; &lt;EM&gt;mail_address_here&lt;/EM&gt;&amp;nbsp; &amp;lt;&amp;nbsp; max.txt&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2011 16:19:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4815857#M641608</guid>
      <dc:creator>Tom Maloy</dc:creator>
      <dc:date>2011-07-06T16:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4815875#M641609</link>
      <description>&lt;P&gt;And if you don't plan to send much text to your message:&lt;/P&gt;&lt;P&gt;if (( ca &amp;gt; pa )); then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $ca&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $pa&lt;/P&gt;&lt;P&gt;fi&amp;nbsp; | mailx&amp;nbsp; -s&amp;nbsp; "max values"&amp;nbsp; &lt;EM&gt;mail_address_here&lt;/EM&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;noting that nothing will print if the values are equal:﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above fragment always prints a value.&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2011 16:28:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4815875#M641609</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-07-06T16:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4816125#M641610</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No matter which script you like ( and we'll use Dennis's since you reference his ), consider learning a Unix philosophy that says do-one-thing-and-do-it-well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The whole script could be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# cat mymax&lt;/P&gt;&lt;P&gt;#/usr/bin/sh&lt;/P&gt;&lt;P&gt;typeset ca=$1&lt;/P&gt;&lt;P&gt;typeset pa=$2&lt;/P&gt;&lt;P&gt;if (( ca &amp;gt; pa )); then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $ca&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $pa&lt;/P&gt;&lt;P&gt;fi ﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...which then could be run to output to your terminal:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# ./mymax 100 99&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...or to a file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# ./mymax 100 99 &amp;gt; myoutput&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...or to email:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# ./mymax 100 99 | mailx -s "Max Value" mymailaddress&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The point is to allow the user to determine where he/she wants the output to appear rather than hard-coding that assumption into your script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...JRF...&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2011 19:17:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4816125#M641610</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-07-06T19:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4816509#M641611</link>
      <description>&lt;P&gt;Hi dennis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if the values are equal , how to print the value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2011 04:17:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4816509#M641611</guid>
      <dc:creator>1a</dc:creator>
      <dc:date>2011-07-07T04:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4816595#M641612</link>
      <description>hi james R.&lt;BR /&gt;&lt;BR /&gt;thanks for your reply. i want to learn shell script .please send any pdf document or ppt</description>
      <pubDate>Thu, 07 Jul 2011 05:43:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4816595#M641612</guid>
      <dc:creator>1a</dc:creator>
      <dc:date>2011-07-07T05:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4816629#M641613</link>
      <description>&lt;P&gt;&amp;gt;if the values are equal, how to print the value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this a new question?&lt;/P&gt;&lt;P&gt;Otherwise my script fragment will print the maximum of the two and always prints, even if equal.&lt;/P&gt;&lt;P&gt;If you only want to print if they are equal:&lt;/P&gt;&lt;P&gt;if (( ca == pa )); then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $ca&lt;/P&gt;&lt;P&gt;fi&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2011 06:07:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4816629#M641613</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-07-07T06:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4817359#M641614</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.hpe.com/t5/user/viewprofilepage/user-id/1202369"&gt;@1a&lt;/a&gt; wrote:&lt;BR /&gt;&lt;BR /&gt;thanks for your reply. i want to learn shell script .please send any pdf document or ppt&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I used to recommend the "HP-UX Shell User's Guide" which was a nice overview of the various shells.&amp;nbsp; With the advent of the "improved" (NOT!) HP websites, this doesn't appear to be available anymore.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regardless, there are any number of good books on shell scripting.&amp;nbsp; Find one for beginners and begin.&amp;nbsp; I urge you to confine your initial learning to the Korn ('ksh') or Bash ('bash') shell rather than the dysfunctional C shell.&amp;nbsp; In HP-UX, the default shell is simply called 'sh' and is a Korn variant.&amp;nbsp; Bash can also be installed on HP-UX though it is usually the standard for most Linux distributions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Part of learning to write code (in any language) is *writing* and *reading*.&amp;nbsp; A very good collection of shell scripts is available here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://www.shelldorado.com/"&gt;http://www.shelldorado.com/&lt;/A&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...JRF...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2011 14:05:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4817359#M641614</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-07-07T14:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4819475#M641615</link>
      <description>&lt;P&gt;I only have a pretty old copy of the shell user's guide but it's still a pretty good one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Find it attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hth,&lt;/P&gt;&lt;P&gt;Stephan&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2011 07:13:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4819475#M641615</guid>
      <dc:creator>Stephan.</dc:creator>
      <dc:date>2011-07-09T07:13:48Z</dc:date>
    </item>
  </channel>
</rss>

