<?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 - how hard can it be in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941712#M288973</link>
    <description>Adam,&lt;BR /&gt;how about:&lt;BR /&gt;if [ `expr substr "$revision" 1 2` = "HP" ]&lt;BR /&gt;then&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;fi</description>
    <pubDate>Fri, 09 Feb 2007 07:18:39 GMT</pubDate>
    <dc:creator>Peter Godron</dc:creator>
    <dc:date>2007-02-09T07:18:39Z</dc:date>
    <item>
      <title>shell script - how hard can it be</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941711#M288972</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I simply want to use an if statement to see whether I should send the output of a command to my output file.&lt;BR /&gt;&lt;BR /&gt;I'm using the following and only want to send the  output to the file if the 1st 2 characters begin HP.&lt;BR /&gt;&lt;BR /&gt;if [ $revision = "HP*" ];then&lt;BR /&gt;&lt;BR /&gt;The above however doesn't work how do I do this.</description>
      <pubDate>Fri, 09 Feb 2007 07:10:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941711#M288972</guid>
      <dc:creator>Adam Noble</dc:creator>
      <dc:date>2007-02-09T07:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - how hard can it be</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941712#M288973</link>
      <description>Adam,&lt;BR /&gt;how about:&lt;BR /&gt;if [ `expr substr "$revision" 1 2` = "HP" ]&lt;BR /&gt;then&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;fi</description>
      <pubDate>Fri, 09 Feb 2007 07:18:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941712#M288973</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-02-09T07:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - how hard can it be</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941713#M288974</link>
      <description>It very much depends on the shell you are doing this in.&lt;BR /&gt;For instance shells such as Bash offer an expansion syntax which doesn't even require some external filter commands and yet let you extract a certain substring.&lt;BR /&gt;However, with HP posix shell you could do this&lt;BR /&gt;(but there are many other solutions conceivable)&lt;BR /&gt;&lt;BR /&gt;(( $(expr "$revision" : ^HP) == 2 )) &amp;amp;&amp;amp; echo do something</description>
      <pubDate>Fri, 09 Feb 2007 07:22:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941713#M288974</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2007-02-09T07:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - how hard can it be</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941714#M288975</link>
      <description>&lt;!--!*#--&gt;Sorry, I made a mistake.&lt;BR /&gt;The correct terminology I was referring to when talking about Bash was "Parameter Substitution" and not "expansion".&lt;BR /&gt;But this is due to my English non-nativeness, I suppose.&lt;BR /&gt;And here's what I meant in Bash:&lt;BR /&gt;&lt;BR /&gt;$ OS=$(uname -s)&lt;BR /&gt;$ [[ ${OS:0:2} = Li ]] &amp;amp;&amp;amp; echo "we are running Linux"&lt;BR /&gt;we are running Linux&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Feb 2007 07:29:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941714#M288975</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2007-02-09T07:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - how hard can it be</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941715#M288976</link>
      <description>thanks it clearly wasn't as straight forward I was using ksh and your solution worked. Thanks to you both</description>
      <pubDate>Fri, 09 Feb 2007 07:38:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941715#M288976</guid>
      <dc:creator>Adam Noble</dc:creator>
      <dc:date>2007-02-09T07:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - how hard can it be</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941716#M288977</link>
      <description>You really want to use pattern matching:&lt;BR /&gt;if [[ "$revision" = HP* ]]; then&lt;BR /&gt;&lt;BR /&gt;As in Ralph's case, you need [[ ]].  Don't quote the HP*.</description>
      <pubDate>Fri, 09 Feb 2007 15:37:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-how-hard-can-it-be/m-p/3941716#M288977</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-02-09T15:37:21Z</dc:date>
    </item>
  </channel>
</rss>

