<?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 echo to create a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445441#M682844</link>
    <description>Hi (again) Patrick:&lt;BR /&gt;&lt;BR /&gt;Ooops, I neglected to escape (backslash) things like "$" :&lt;BR /&gt;&lt;BR /&gt;# cat ./mymaker&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;cat &amp;lt;&amp;lt;-EOF! &amp;gt; pvtimeout.sh&lt;BR /&gt;for i in \`grep \$FRAME /root_home/powermt.sort.fil |awk '{print \$7}'\`&lt;BR /&gt;do&lt;BR /&gt;echo \${i} ----------&lt;BR /&gt;pvchange -t 90 /dev/dsk/\${i}&lt;BR /&gt;pvchange -t 90 /dev/dsk/\${i}&lt;BR /&gt;echo pvdisplay /dev/dsk/\${i} |grep Timeout&lt;BR /&gt;pvdisplay /dev/dsk/\${i} |grep Timeout&lt;BR /&gt;done&lt;BR /&gt;EOF!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Tue, 23 Jun 2009 16:41:05 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2009-06-23T16:41:05Z</dc:date>
    <item>
      <title>Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445438#M682841</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;I want to be able to create a script on the fly from another script by echoing lines into a file, but am running into difficulty, as it isn't working right.  What am I doing wrong? &lt;BR /&gt;&lt;BR /&gt;[CODE]&lt;BR /&gt;echo "for i in `grep $FRAME /root_home/powermt.sort.fil |awk '{print $7}'`" &amp;gt; pvtimout_set.sh&lt;BR /&gt;echo "do" &amp;gt;&amp;gt; pvtimout_set.sh&lt;BR /&gt;echo "echo ${i} ----------" &amp;gt;&amp;gt; pvtimout_set.sh&lt;BR /&gt;echo "echo pvchange -t 90 /dev/dsk/${i}" &amp;gt;&amp;gt; pvtimout_set.sh&lt;BR /&gt;echo "pvchange -t 90 /dev/dsk/${i}" &amp;gt;&amp;gt; pvtimout_set.sh&lt;BR /&gt;echo &amp;gt;&amp;gt; pvtimout_set.sh&lt;BR /&gt;echo "echo pvdisplay /dev/dsk/${i} |grep Timeout" &amp;gt;&amp;gt; pvtimout_set.sh&lt;BR /&gt;echo "pvdisplay /dev/dsk/${i} |grep Timeout" &amp;gt;&amp;gt; pvtimout_set.sh&lt;BR /&gt;echo &amp;gt;&amp;gt; pvtimout_set.sh&lt;BR /&gt;echo "done 2&amp;gt; /root_home/scripts/pvtimout.out 1&amp;gt;&amp;amp;2" &amp;gt;&amp;gt; pvtimout_set.sh&lt;BR /&gt;[/CODE]&lt;BR /&gt;&lt;BR /&gt;Thanks for any help in advance!</description>
      <pubDate>Tue, 23 Jun 2009 16:22:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445438#M682841</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2009-06-23T16:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445439#M682842</link>
      <description>any special character you want to echo into this script is getting interpreted by shell and resulting value is getting placed into the pvtimeout_set.sh&lt;BR /&gt;&lt;BR /&gt;those characters, including but not limited to, $,&amp;gt;,&amp;lt;,{,},'," any other I might not have caught, will need to be escaped, by preceeding them with a backslash character.&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
      <pubDate>Tue, 23 Jun 2009 16:32:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445439#M682842</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-06-23T16:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445440#M682843</link>
      <description>Hi Patrick:&lt;BR /&gt;&lt;BR /&gt;IF you add a 'set -x' to this code you will see that evaluation of statements like "`grep $FRAME...`" is occuring and hence your script is hanging.&lt;BR /&gt;&lt;BR /&gt;A much easier, clearer way to do this is with a HERE-DOC like this:&lt;BR /&gt;&lt;BR /&gt;# cat .mymaker&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;cat &amp;lt;&amp;lt;-EOF! &amp;gt; pvtimeout.sh&lt;BR /&gt;for i in \`grep $FRAME /root_home/powermt.sort.fil |awk '{print $7}'\`&lt;BR /&gt;do&lt;BR /&gt;echo ${i} ----------&lt;BR /&gt;pvchange -t 90 /dev/dsk/${i}&lt;BR /&gt;pvchange -t 90 /dev/dsk/${i}&lt;BR /&gt;echo pvdisplay /dev/dsk/${i} |grep Timeout&lt;BR /&gt;pvdisplay /dev/dsk/${i} |grep Timeout&lt;BR /&gt;done&lt;BR /&gt;EOF!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Jun 2009 16:33:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445440#M682843</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-06-23T16:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445441#M682844</link>
      <description>Hi (again) Patrick:&lt;BR /&gt;&lt;BR /&gt;Ooops, I neglected to escape (backslash) things like "$" :&lt;BR /&gt;&lt;BR /&gt;# cat ./mymaker&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;cat &amp;lt;&amp;lt;-EOF! &amp;gt; pvtimeout.sh&lt;BR /&gt;for i in \`grep \$FRAME /root_home/powermt.sort.fil |awk '{print \$7}'\`&lt;BR /&gt;do&lt;BR /&gt;echo \${i} ----------&lt;BR /&gt;pvchange -t 90 /dev/dsk/\${i}&lt;BR /&gt;pvchange -t 90 /dev/dsk/\${i}&lt;BR /&gt;echo pvdisplay /dev/dsk/\${i} |grep Timeout&lt;BR /&gt;pvdisplay /dev/dsk/\${i} |grep Timeout&lt;BR /&gt;done&lt;BR /&gt;EOF!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 23 Jun 2009 16:41:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445441#M682844</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-06-23T16:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445442#M682845</link>
      <description>&amp;gt;JRF: I neglected to escape (backslash) things like "$":&lt;BR /&gt;&lt;BR /&gt;If you are using "\" before EVERY "$", you can stop that by quoting the word:&lt;BR /&gt;cat &amp;lt;&amp;lt;-\EOF!</description>
      <pubDate>Tue, 23 Jun 2009 22:32:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445442#M682845</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-06-23T22:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445443#M682846</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: If you are using "\" before EVERY "$", you can stop that by quoting the word:&lt;BR /&gt;cat &amp;lt;&amp;lt;-\EOF!&lt;BR /&gt;&lt;BR /&gt;This is a bit different from Perl and I didn't really _read_ the manpage sentence that says, "If any character of word is quoted...".  You make that clear --- thanks for the pointer! &lt;BR /&gt;&lt;BR /&gt;/* NO Points please for this note */&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Jun 2009 23:36:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445443#M682846</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-06-23T23:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445444#M682847</link>
      <description>Hi Patrick,&lt;BR /&gt;you can use&lt;BR /&gt;echo &lt;BR /&gt;{ &lt;BR /&gt;# begin script&lt;BR /&gt;your code&lt;BR /&gt;# end script&lt;BR /&gt;}&amp;gt;your script&lt;BR /&gt;&lt;BR /&gt;all code within {} will be redirect to your script.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Wed, 24 Jun 2009 06:31:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445444#M682847</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2009-06-24T06:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445445#M682848</link>
      <description>Here is what I ended up using:&lt;BR /&gt;&lt;BR /&gt;cat &amp;lt;&amp;lt;-EOF! &amp;gt; pvtimeout_set.sh&lt;BR /&gt;for i in \`grep ${FRAME} /tmp/powermt.sort.out |awk '{print \$7}'\`&lt;BR /&gt;do&lt;BR /&gt;echo \${i} ----------&lt;BR /&gt;echo pvchange -t ${TIMEOUT} /dev/dsk/\${i}&lt;BR /&gt;pvchange -t ${TIMEOUT} /dev/dsk/\${i}&lt;BR /&gt;echo pvdisplay /dev/dsk/\${i} |grep Timeout&lt;BR /&gt;pvdisplay /dev/dsk/\${i} |grep Timeout&lt;BR /&gt;echo&lt;BR /&gt;done&lt;BR /&gt;EOF!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Arturo,&lt;BR /&gt;&lt;BR /&gt;That will pick up the echo statements I put into the script as well?&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Jun 2009 11:42:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445445#M682848</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2009-06-24T11:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445446#M682849</link>
      <description>Dennis, thx for the quoting tip.  &lt;BR /&gt;&lt;BR /&gt;I wonder how many times I've overlooked that sentence?&lt;BR /&gt;&lt;BR /&gt;no points pls</description>
      <pubDate>Wed, 24 Jun 2009 13:14:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445446#M682849</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-06-24T13:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445447#M682850</link>
      <description>&lt;!--!*#--&gt;&amp;gt;Here is what I ended up using:&lt;BR /&gt;&lt;BR /&gt;You forgot a "\" for ${FRAME}.  Note your echo piped to grep.&lt;BR /&gt;&lt;BR /&gt;I would suggest you redo it as:&lt;BR /&gt;cat &amp;lt;&amp;lt;-\EOF!&lt;BR /&gt;for i in $(grep ${FRAME} /tmp/powermt.sort.out | awk '{print $7}'); do&lt;BR /&gt;   echo "${i} ----------"&lt;BR /&gt;   echo "pvchange -t ${TIMEOUT} /dev/dsk/${i}"&lt;BR /&gt;   pvchange -t ${TIMEOUT} /dev/dsk/${i}&lt;BR /&gt;   echo "pvdisplay /dev/dsk/${i} | grep Timeout"&lt;BR /&gt;   pvdisplay /dev/dsk/${i} | grep Timeout&lt;BR /&gt;   echo&lt;BR /&gt;done&lt;BR /&gt;EOF!&lt;BR /&gt;&lt;BR /&gt;&amp;gt;That will pick up the echo statements I put into the script as well?&lt;BR /&gt;&lt;BR /&gt;See my improvements.</description>
      <pubDate>Thu, 25 Jun 2009 02:50:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445447#M682850</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-06-25T02:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445448#M682851</link>
      <description>"You forgot a "\" for ${FRAME}.  Note your echo piped to grep."&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I did this on purpose, as I wanted the ${FRAME} variable passed.</description>
      <pubDate>Thu, 25 Jun 2009 04:36:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445448#M682851</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2009-06-25T04:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using echo to create a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445449#M682852</link>
      <description>&amp;gt;I did this on purpose, as I wanted the ${FRAME} variable passed.&lt;BR /&gt;&lt;BR /&gt;Ah, that's why it was empty for me.</description>
      <pubDate>Thu, 25 Jun 2009 06:11:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-echo-to-create-a-script/m-p/4445449#M682852</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-06-25T06:11:33Z</dc:date>
    </item>
  </channel>
</rss>

