<?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: substituting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754463#M722192</link>
    <description>When you set one of your parameters, add the appropriate switch then...an empty named parameter that returns nothing will not interfere with the operation of the command line (as opposed to a hard-coded switch that requires a value).  For example:&lt;BR /&gt;&lt;BR /&gt;    maxPEperPV=$(...whatever you use now...)&lt;BR /&gt;    if ( ${maxPEperPV} &amp;gt; 0 )&lt;BR /&gt;    then&lt;BR /&gt;        maxPEperPV="-e ${maxPEperPV}"&lt;BR /&gt;    else&lt;BR /&gt;        maxPEperPV=""&lt;BR /&gt;    fi&lt;BR /&gt;    # do similar ofr PESize, or even leverage&lt;BR /&gt;    # the above test&lt;BR /&gt;    .&lt;BR /&gt;    .&lt;BR /&gt;    .&lt;BR /&gt;    vgcreate $opstr -p $maxPV -l $maxLV $PESize $maxPEperPV $vg $dskName&lt;BR /&gt;&lt;BR /&gt;If PESize and maxPEperPV were specified, they will be used, if not, they interpret to nothing.&lt;BR /&gt;&lt;BR /&gt;-dlt-&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 02 Jul 2002 15:04:06 GMT</pubDate>
    <dc:creator>David Totsch</dc:creator>
    <dc:date>2002-07-02T15:04:06Z</dc:date>
    <item>
      <title>substituting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754455#M722184</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Sometime, I will have the following string:&lt;BR /&gt;"vgcreate $opstr -p $maxPV -l $maxLV -s $PESize -e $maxPEperPV $vg $dskName"&lt;BR /&gt;&lt;BR /&gt;Also, in some cases, I will need to remove some of the options specified in the above string and have the following format:&lt;BR /&gt;vgcreate $opstr -p $maxPV -l $maxLV $vg $dskNam&lt;BR /&gt;&lt;BR /&gt;(no -e $maxPEperPV, -s $PESize)&lt;BR /&gt;&lt;BR /&gt;Do you know how do it?&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Fri, 28 Jun 2002 12:43:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754455#M722184</guid>
      <dc:creator>andi_1</dc:creator>
      <dc:date>2002-06-28T12:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: substituting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754456#M722185</link>
      <description>Hi Andi,&lt;BR /&gt;&lt;BR /&gt;what about putting the two commands into a script and give a hard link to that script. ( a second name, same inode number):&lt;BR /&gt;vi name1&lt;BR /&gt;&lt;BR /&gt;case $0 in&lt;BR /&gt;name1) first_possible_command_line ;;&lt;BR /&gt;name2) second_possible_command_line ;;&lt;BR /&gt;esac &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;After this the following command line:&lt;BR /&gt;&lt;BR /&gt;ln name1 name2&lt;BR /&gt;&lt;BR /&gt;That should do it for you!&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Jun 2002 12:51:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754456#M722185</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-28T12:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: substituting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754457#M722186</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;U can use sed command to remove unwanted string. It is like this&lt;BR /&gt;&lt;BR /&gt;#sed 's/-s $PEsize -e $maxPEperPV//g' file&lt;BR /&gt;&lt;BR /&gt;I hope this will do for U.&lt;BR /&gt;&lt;BR /&gt;Best of luck&lt;BR /&gt;Shahul</description>
      <pubDate>Fri, 28 Jun 2002 12:51:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754457#M722186</guid>
      <dc:creator>Shahul</dc:creator>
      <dc:date>2002-06-28T12:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: substituting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754458#M722187</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;This would remove the portion you don't want:&lt;BR /&gt;&lt;BR /&gt;# sed -e 's/-s $PESize -e $maxPEperPV //'&lt;BR /&gt;&lt;BR /&gt;For instance:&lt;BR /&gt;&lt;BR /&gt;# X='vgcreate $opstr -p $maxPV -l $maxLV -s $PESize -e $maxPEperPV $vg $dskName'&lt;BR /&gt; &lt;BR /&gt;# Y=`echo $X|sed -e 's/-s $PESize -e $maxPEperPV //'`&lt;BR /&gt;&lt;BR /&gt;# echo $Y&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Jun 2002 12:57:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754458#M722187</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-06-28T12:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: substituting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754459#M722188</link>
      <description>Hi again Andi,&lt;BR /&gt;&lt;BR /&gt;sorry, i forgot to mention why this works....&lt;BR /&gt;&lt;BR /&gt;$0 stores the name of the command to execute, and you simply check, which name was used when the script was called. If you used name1, the first command line is executed, in your case with all options... If the used name was name2, the alternative command line is executed.&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Fri, 28 Jun 2002 12:57:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754459#M722188</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-28T12:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: substituting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754460#M722189</link>
      <description>Thank you very much for your input!&lt;BR /&gt;&lt;BR /&gt;One las thing:&lt;BR /&gt;&lt;BR /&gt;how can I remove -e -s but without specifying $PESize, or $MAXPEperPV?&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;remove -s and the next value?&lt;BR /&gt;&lt;BR /&gt;Thank you!</description>
      <pubDate>Fri, 28 Jun 2002 13:19:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754460#M722189</guid>
      <dc:creator>andi_1</dc:creator>
      <dc:date>2002-06-28T13:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: substituting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754461#M722190</link>
      <description>Hi (again)!&lt;BR /&gt;&lt;BR /&gt;OK, here's a small script which will do what you want:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo $1 | awk '{K=split($0,a)&lt;BR /&gt;    N=1;while (N &amp;lt;= K)&lt;BR /&gt;        { if (a[N]=="-s") N=N+2&lt;BR /&gt;          if (a[N]=="-e") N=N+2&lt;BR /&gt;          printf "%s ",a[N];N++&lt;BR /&gt;        }&lt;BR /&gt;    printf "\n"&lt;BR /&gt;    }'&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;...pass your command string to this script.  If the string contains the '-e' or '-s' option, the next argument is removed, otherwise the command is left intact and re-echoed.  If we call the script 'my.sh' you could do this:&lt;BR /&gt;&lt;BR /&gt;# X=`./my.sh 'vgcreate $opstr -p $maxPV -l $maxLV -s $PESize -e $maxPEperPV $vg $dskName'` &lt;BR /&gt;&lt;BR /&gt;# echo $X&lt;BR /&gt;&lt;BR /&gt;...yields:&lt;BR /&gt;&lt;BR /&gt;vgcreate $opstr -p $maxPV -l $maxLV $vg $dskName&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 28 Jun 2002 15:23:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754461#M722190</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-06-28T15:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: substituting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754462#M722191</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;The script I posted above has one dumb flaw.  It assumes that the arguments passed to it are quoted.  Replace "$1" with "$@", or use the attachment here (...the Forum mechanics make mince-meat of formatted scripts!).&lt;BR /&gt;&lt;BR /&gt;Thus:&lt;BR /&gt;&lt;BR /&gt;# ./my.sh vgcreate -e 4096 -l 10 -p 50 -s 8 /dev/vg01 /dev/dsk/cXtYdZ&lt;BR /&gt;&lt;BR /&gt;...returns:&lt;BR /&gt;&lt;BR /&gt;vgcreate -l 10 -p 50 /dev/vg01 /dev/dsk/cXtYdZ&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 29 Jun 2002 12:07:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754462#M722191</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-06-29T12:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: substituting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754463#M722192</link>
      <description>When you set one of your parameters, add the appropriate switch then...an empty named parameter that returns nothing will not interfere with the operation of the command line (as opposed to a hard-coded switch that requires a value).  For example:&lt;BR /&gt;&lt;BR /&gt;    maxPEperPV=$(...whatever you use now...)&lt;BR /&gt;    if ( ${maxPEperPV} &amp;gt; 0 )&lt;BR /&gt;    then&lt;BR /&gt;        maxPEperPV="-e ${maxPEperPV}"&lt;BR /&gt;    else&lt;BR /&gt;        maxPEperPV=""&lt;BR /&gt;    fi&lt;BR /&gt;    # do similar ofr PESize, or even leverage&lt;BR /&gt;    # the above test&lt;BR /&gt;    .&lt;BR /&gt;    .&lt;BR /&gt;    .&lt;BR /&gt;    vgcreate $opstr -p $maxPV -l $maxLV $PESize $maxPEperPV $vg $dskName&lt;BR /&gt;&lt;BR /&gt;If PESize and maxPEperPV were specified, they will be used, if not, they interpret to nothing.&lt;BR /&gt;&lt;BR /&gt;-dlt-&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Jul 2002 15:04:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/substituting/m-p/2754463#M722192</guid>
      <dc:creator>David Totsch</dc:creator>
      <dc:date>2002-07-02T15:04:06Z</dc:date>
    </item>
  </channel>
</rss>

