<?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: |&amp;amp; - Pipe in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336760#M874401</link>
    <description>You can also use &amp;amp;&amp;amp; in a condition statement like this from cron:&lt;BR /&gt;&lt;BR /&gt;0 0 * * * [ -d /oracle/PROD/920_64 ] &amp;amp;&amp;amp; /export/APPL/spaceman/cleanarch &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;That checks to see if the directory /oracle/PROD/920_64 exists, and if yes, then executes the cleanarch script...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;</description>
    <pubDate>Wed, 21 Jul 2004 07:47:13 GMT</pubDate>
    <dc:creator>Geoff Wild</dc:creator>
    <dc:date>2004-07-21T07:47:13Z</dc:date>
    <item>
      <title>|&amp; - Pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336756#M874397</link>
      <description>I was wondering if anyone could help me understand this |&amp;amp; symbol.&lt;BR /&gt;&lt;BR /&gt;this is from the man page of sh-posix&lt;BR /&gt;&lt;BR /&gt;          |&amp;amp;   Causes asynchronous execution of the preceding command or&lt;BR /&gt;                pipeline with a two-way pipe established to the parent&lt;BR /&gt;                shell.  The standard input and output of the spawned command&lt;BR /&gt;                can be written to and read from by the parent shell using&lt;BR /&gt;                the -p option of the special commands read and print.&lt;BR /&gt;&lt;BR /&gt;man page doesnt make much sense to me and /sbin/init.d/swconfig seem to use that&lt;BR /&gt;&lt;BR /&gt; # grep "\|\&amp;amp;" /sbin/init.d/swconfig&lt;BR /&gt;      ls |&amp;amp; &lt;BR /&gt;      ls |&amp;amp; &lt;BR /&gt;      cat /var/adm/sw/cleanupfile |&amp;amp;&lt;BR /&gt; #&lt;BR /&gt;&lt;BR /&gt;I understand &lt;COMMAND1&gt; |&amp;amp; will execute the command1 in the background and write to a pipe that can be read using the -p option of read.&lt;BR /&gt;&lt;BR /&gt;I was wondering if you guys are aware of any other use to this syntax or when it can be best used ?&lt;/COMMAND1&gt;</description>
      <pubDate>Tue, 20 Jul 2004 18:13:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336756#M874397</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2004-07-20T18:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: |&amp; - Pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336757#M874398</link>
      <description>I can see this pipe being useful for challenge-response type programs where you want to script responses or sequences.&lt;BR /&gt;&lt;BR /&gt;Whilst we do this for a number of bits and pieces using the perl 'open()' pipe, it could just as easily use this.&lt;BR /&gt;&lt;BR /&gt;If you look into where those |&amp;amp; pipes are used in /sbin/init.d/swconfig, you'll see shortly after them what use they are put too:&lt;BR /&gt;&lt;BR /&gt;    # If exist, cleanup alternate cmds&lt;BR /&gt;&lt;BR /&gt;    if [[ -d /usr/lbin/sw/bin ]]&lt;BR /&gt;    then&lt;BR /&gt;        (&lt;BR /&gt;        typeset first=1&lt;BR /&gt;        cd /usr/lbin/sw/bin&lt;BR /&gt;        ls |&amp;amp;&lt;BR /&gt;        while read -p old_cmd&lt;BR /&gt;        do&lt;BR /&gt;            if [[ ${first} = 1 ]]&lt;BR /&gt;            then&lt;BR /&gt;                msg star "Removing files from '/usr/lbin/sw/bin'"&lt;BR /&gt;                first=0&lt;BR /&gt;            fi&lt;BR /&gt;            rm -f ${old_cmd}&lt;BR /&gt;        done&lt;BR /&gt;        )&lt;BR /&gt;    fi&lt;BR /&gt;&lt;BR /&gt;It goes through a directory listing of the current directory, and removes them, bypassing the need for shell expansion.&lt;BR /&gt;&lt;BR /&gt;The second entry isn't all that more exciting (identical infact), and the third use makes it just a little testing and stuff, before moving the '/var/adm/sw/cleanupfile' out of the way.&lt;BR /&gt;&lt;BR /&gt;If you had a program of which did question/answer however, the |&amp;amp; starts to be of more use.  You send it a question with 'print -p &lt;TEXT&gt;', then it sends you an answer which you grab using 'read -p VAR'.  You can then act on the answer, do actions, then send the next question etc. etc..&lt;BR /&gt;&lt;BR /&gt;Or you could use the '&amp;gt;&amp;amp;p' and '&amp;lt;&amp;amp;p' to output/input from your own custom commands into the backgrounded pipe.&lt;/TEXT&gt;</description>
      <pubDate>Wed, 21 Jul 2004 00:08:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336757#M874398</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2004-07-21T00:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: |&amp; - Pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336758#M874399</link>
      <description>&lt;BR /&gt; &lt;BR /&gt;Here's another example that is quite useful.&lt;BR /&gt; &lt;BR /&gt;bc |&amp;amp;&lt;BR /&gt;print -p "10 + 10"&lt;BR /&gt;read -p answer&lt;BR /&gt;echo $answer&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Jul 2004 02:37:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336758#M874399</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-07-21T02:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: |&amp; - Pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336759#M874400</link>
      <description>It is a coprocess. You have the possibility to have more than one coprocess, by dupping the pipes to others fds:&lt;BR /&gt;example to use a socket in a script:&lt;BR /&gt;telnet anothersystem  7 |&amp;amp;&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;lt;&amp;amp;p 4&amp;gt;&amp;amp;p&lt;BR /&gt;&lt;BR /&gt;cat &amp;lt;&amp;amp;3 &amp;amp;&lt;BR /&gt;echo hello &amp;gt;&amp;amp;4&lt;BR /&gt;exec 4&amp;gt;&amp;amp;-&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Jul 2004 03:58:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336759#M874400</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2004-07-21T03:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: |&amp; - Pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336760#M874401</link>
      <description>You can also use &amp;amp;&amp;amp; in a condition statement like this from cron:&lt;BR /&gt;&lt;BR /&gt;0 0 * * * [ -d /oracle/PROD/920_64 ] &amp;amp;&amp;amp; /export/APPL/spaceman/cleanarch &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;That checks to see if the directory /oracle/PROD/920_64 exists, and if yes, then executes the cleanarch script...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Jul 2004 07:47:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336760#M874401</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2004-07-21T07:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: |&amp; - Pipe</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336761#M874402</link>
      <description>Thanks to all of you. &lt;BR /&gt;&lt;BR /&gt;Sorry Geoff, I think you have misread the question. I was talking about "|&amp;amp;" and not about "&amp;amp;&amp;amp;".</description>
      <pubDate>Wed, 21 Jul 2004 17:32:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/amp-pipe/m-p/3336761#M874402</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2004-07-21T17:32:25Z</dc:date>
    </item>
  </channel>
</rss>

