<?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: using xargs and read from standard input in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341857#M657052</link>
    <description>Hi Tom:&lt;BR /&gt;&lt;BR /&gt;One way is to change your subprogram to specifically associate STDIN with '/dev/tty' as:&lt;BR /&gt;&lt;BR /&gt;#usr/bin/ksh&lt;BR /&gt;exec 0&amp;lt; /dev/tty # NOTE!&lt;BR /&gt;echo "this is script: `basename $0`"&lt;BR /&gt;echo "Number. Par: $#"&lt;BR /&gt;echo "Parameter: $*"&lt;BR /&gt;echo "Input: "&lt;BR /&gt;read input&lt;BR /&gt;echo $input&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Wed, 21 Jan 2009 12:54:59 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2009-01-21T12:54:59Z</dc:date>
    <item>
      <title>using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341855#M657050</link>
      <description>hello,&lt;BR /&gt;&lt;BR /&gt;is it possible to use command "xargs" , start a subprogramm and read in the sub programm from standard input ?&lt;BR /&gt;example below, it isn't possible to read from standard input in "sub programm". maybe any ideas to fix it ? command "xargs" exists in many shell scripts.&lt;BR /&gt;&lt;BR /&gt;main programm:&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;cat xargs.lis | xargs -l -x -t ./u_xargs-test.sh&lt;BR /&gt;&lt;BR /&gt;sub programm:&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;echo "this is script: `basename $0`"&lt;BR /&gt;echo "Number. Par: $#"&lt;BR /&gt;echo "Parameter: $*"&lt;BR /&gt;&lt;BR /&gt;echo "Input: "&lt;BR /&gt;read input    &amp;lt;= isn't possible to read from standard input&lt;BR /&gt;&lt;BR /&gt;echo $input&lt;BR /&gt;&lt;BR /&gt;regards,tom</description>
      <pubDate>Wed, 21 Jan 2009 12:13:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341855#M657050</guid>
      <dc:creator>Billa-User</dc:creator>
      <dc:date>2009-01-21T12:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341856#M657051</link>
      <description>sorry, i forget to describe the content of example file "xargs.lis" :&lt;BR /&gt;&lt;BR /&gt;parameter1&lt;BR /&gt;parameter1 parameter2&lt;BR /&gt;parameter1 parameter2 parameter3&lt;BR /&gt;&lt;BR /&gt;i called "main programm" : h_xargs-test.sh,&lt;BR /&gt;"sub programm" u_xargs-test.sh &lt;BR /&gt;&lt;BR /&gt;regards,tom&lt;BR /&gt;&lt;BR /&gt;regards,tom</description>
      <pubDate>Wed, 21 Jan 2009 12:16:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341856#M657051</guid>
      <dc:creator>Billa-User</dc:creator>
      <dc:date>2009-01-21T12:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341857#M657052</link>
      <description>Hi Tom:&lt;BR /&gt;&lt;BR /&gt;One way is to change your subprogram to specifically associate STDIN with '/dev/tty' as:&lt;BR /&gt;&lt;BR /&gt;#usr/bin/ksh&lt;BR /&gt;exec 0&amp;lt; /dev/tty # NOTE!&lt;BR /&gt;echo "this is script: `basename $0`"&lt;BR /&gt;echo "Number. Par: $#"&lt;BR /&gt;echo "Parameter: $*"&lt;BR /&gt;echo "Input: "&lt;BR /&gt;read input&lt;BR /&gt;echo $input&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 21 Jan 2009 12:54:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341857#M657052</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-01-21T12:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341858#M657053</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;besides JRF's solution, you can see it clearly, that such reading of stdin will not work plain, when you look on this equivalent form of your command:&lt;BR /&gt;xargs -l -x -t ./u_xargs-test.sh &lt;XARGS.LIS&gt;&lt;/XARGS.LIS&gt;&lt;BR /&gt;Stdin is already redirected.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Wed, 21 Jan 2009 14:17:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341858#M657053</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2009-01-21T14:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341859#M657054</link>
      <description>thank you very,very much, great solution.</description>
      <pubDate>Wed, 21 Jan 2009 14:30:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341859#M657054</guid>
      <dc:creator>Billa-User</dc:creator>
      <dc:date>2009-01-21T14:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341860#M657055</link>
      <description>hello,&lt;BR /&gt;&lt;BR /&gt;i have a new question to this old thread:&lt;BR /&gt;&lt;BR /&gt;i detect following case:&lt;BR /&gt;&lt;BR /&gt;i use this statement (u_xargs-test.sh is a sub-programm):&lt;BR /&gt;xargs -l -x -t ./u_xargs-test.sh &lt;XARGS.LIS&gt;&lt;/XARGS.LIS&gt;&lt;BR /&gt;when a error occurs in "./u_xargs-test.sh" or i want to stop program with "exit 1" the "loop" of xargs doesn't stop. also "set -e" in "h_xargs-test.sh" or "u_xargs-test.sh" has no impact.&lt;BR /&gt;&lt;BR /&gt;how can i stop sub program , when i use the statement "xargs" ?&lt;BR /&gt;&lt;BR /&gt;regards</description>
      <pubDate>Mon, 28 Feb 2011 14:38:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341860#M657055</guid>
      <dc:creator>Billa-User</dc:creator>
      <dc:date>2011-02-28T14:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341861#M657056</link>
      <description>Hi Tom:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; how can i stop sub program , when i use the statement "xargs" ?&lt;BR /&gt;&lt;BR /&gt;I don't know of anyway to do this.  The 'xargs' process invokes your script for bundles of '-l' size arguments --- in this case *one*.  This means that a new process (your script) is instantiated for every line read from you input.  Whether or not the script (process) succeeds or fails doesn't matter to 'xargs'; it merely reads another bundle of input.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 28 Feb 2011 15:14:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341861#M657056</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-28T15:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341862#M657057</link>
      <description>Hi (again) Tom:&lt;BR /&gt;&lt;BR /&gt;OK, duh!  If you want your invoked process to terminate the 'xargs' statement, simply issue a 'kill ${PPID}' in your script.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 28 Feb 2011 15:25:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341862#M657057</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-28T15:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341863#M657058</link>
      <description>&amp;gt;JRF: If you want your invoked process to terminate the 'xargs' statement, simply issue a 'kill ${PPID}'&lt;BR /&gt;&lt;BR /&gt;You may want to check to see that your parent actually is xargs(1).</description>
      <pubDate>Mon, 28 Feb 2011 18:16:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341863#M657058</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-02-28T18:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341864#M657059</link>
      <description>hello,&lt;BR /&gt;&lt;BR /&gt;&amp;gt; You may want to check to see that your parent actually is xargs(1).&lt;BR /&gt;&lt;BR /&gt;xargs terminates if it receives a return code of -1 from command or if&lt;BR /&gt;it cannot execute command.  When command is a shell program, it should&lt;BR /&gt;explicitly exit (see sh(1)) with an appropriate value to avoid&lt;BR /&gt;accidentally returning with -1.&lt;BR /&gt;&lt;BR /&gt;the "loop" of xargs continues , when i try to stop the sub-shell-program like &lt;BR /&gt;&lt;BR /&gt;if [ ! -d directory ]&lt;BR /&gt;then&lt;BR /&gt;  echo "dir not found"&lt;BR /&gt;  exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;so i have to change command "xargs" to a statement like "while" , isn't it ?&lt;BR /&gt;it is no so easy to change those commands :&lt;BR /&gt;&lt;BR /&gt;nl -ba -w1 -s" " xargs.lis | xargs -l -x -t ./u_xargs-test.sh par1&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Mar 2011 06:42:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341864#M657059</guid>
      <dc:creator>Billa-User</dc:creator>
      <dc:date>2011-03-01T06:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341865#M657060</link>
      <description>&amp;gt;the "loop" of xargs continues, when I try to stop the sub-shell-program like&lt;BR /&gt;&amp;gt; exit 1&lt;BR /&gt;&lt;BR /&gt;As documented, you need: exit -1</description>
      <pubDate>Tue, 01 Mar 2011 08:37:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341865#M657060</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-03-01T08:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: using xargs and read from standard input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341866#M657061</link>
      <description>thx ! now the sub-shell-program stops with "exit -1"&lt;BR /&gt;&lt;BR /&gt;i am sorry , i miss the exact meaning ...</description>
      <pubDate>Tue, 01 Mar 2011 12:15:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-xargs-and-read-from-standard-input/m-p/4341866#M657061</guid>
      <dc:creator>Billa-User</dc:creator>
      <dc:date>2011-03-01T12:15:17Z</dc:date>
    </item>
  </channel>
</rss>

