<?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: Wrapper Script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327502#M671218</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; all the scripts need parameter and it might be different or some of them may be the same. In this condition how can I pass parameter from wrapper.&lt;BR /&gt;&lt;BR /&gt;OldSchool has provided you a nicely detailed set of choices!&lt;BR /&gt;&lt;BR /&gt;You need to pass everything you need to your "wrapper".  Perhaps the first argument ($1) [or switch and argument] should identify which of the four scripts is to be run.  Then, the remaining arguments are applied as needed.&lt;BR /&gt;&lt;BR /&gt;Providing more details would be helpful.  I suggest you look at the manpages for 'sh-posix' and for 'getopts'.  There is actually a good example of how to use 'getopts' in those manpages.&lt;BR /&gt;&lt;BR /&gt;You could also benefit by looking at this site:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com/" target="_blank"&gt;http://www.shelldorado.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Tue, 23 Dec 2008 15:38:27 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2008-12-23T15:38:27Z</dc:date>
    <item>
      <title>Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327496#M671212</link>
      <description>I am trying write a wrapper script which calls 4 different scripts. Those 4 scripts run fine individually and all of them require some parameters for to run. It can be server name, dest_dir, source_dir or stuff like that. Anyone can suggest me how can I do that. I am confused because all the script needs different parameters.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance. Any help will be appreciated</description>
      <pubDate>Mon, 22 Dec 2008 16:38:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327496#M671212</guid>
      <dc:creator>pareshan</dc:creator>
      <dc:date>2008-12-22T16:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327497#M671213</link>
      <description>options include, but aren't limited to:&lt;BR /&gt;&lt;BR /&gt;some kind of config file that stores the various items needed and is read at exection&lt;BR /&gt;&lt;BR /&gt;prompt for the individual parameters, store them variables and apply the needed variables to the calls to the individual scripts...may work acceptably for an interactive process&lt;BR /&gt;&lt;BR /&gt;place all of the required input on the command line and parse that as needed using case or getops or???&lt;BR /&gt;&lt;BR /&gt;if the existing 4 scripts use command line arguments that will not change, then it is as simple as coding the call w/ the correct arguements in the correct order.&lt;BR /&gt;&lt;BR /&gt;If the existing 4 scripts prompt for input, and that input not change, then a "HERE-DOC" may be suitable.&lt;BR /&gt;&lt;BR /&gt;It all depends on what you want to do (currently not well defined) and how the original 4 scripts get their input (totally undefined).&lt;BR /&gt;&lt;BR /&gt;Methods can be "mixed and matched" as needed, are other methods are probably available, I simply listed the first few that occurred to me.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Dec 2008 17:26:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327497#M671213</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-12-22T17:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327498#M671214</link>
      <description>Its a korn shell script and the script I am writting is not supposed to be interactive its supposted to be automated. And all the four scripts are korn shell scripts. Parameters should be passed to them in a command line (Positional Parameter). &lt;BR /&gt;&lt;BR /&gt;The main task is I have 4 individual scripts which run fine but I have to integrate it together as one script thats why I thought about wrapper script. If there is another efficient way for to solve this problem also I am ready to use that way because I believer there are more than one way to do things correctly</description>
      <pubDate>Mon, 22 Dec 2008 17:37:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327498#M671214</guid>
      <dc:creator>pareshan</dc:creator>
      <dc:date>2008-12-22T17:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327499#M671215</link>
      <description>"Its a korn shell script and the script I am writting is not supposed to be interactive its supposted to be automated. And all the four scripts are korn shell scripts. Parameters should be passed to them in a command line (Positional Parameter)."&lt;BR /&gt;&lt;BR /&gt;Yeah...right...thats a simple restatement of the original, and not much more informative, so lets try this:&lt;BR /&gt;&lt;BR /&gt;The 4 original scripts take positional parameters...DO THOSE EVER VARY when your wrapper runs? Or, when the wrapper runs them, are the inputs to the 4 original scripts always the same?&lt;BR /&gt;&lt;BR /&gt;if they never vary then the wrapper can be something like:&lt;BR /&gt;===============&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;script1 a b c&lt;BR /&gt;script2 d e f&lt;BR /&gt;script3 a d e&lt;BR /&gt;script4 g f e&lt;BR /&gt;===============&lt;BR /&gt;&lt;BR /&gt;where a-g are the "positional parameters" you need to pass to scripts1-4, and they are "hardcoded"&lt;BR /&gt;&lt;BR /&gt;if they vary, then you can either write a wrapper for each version, or something like:&lt;BR /&gt;&lt;BR /&gt;========================&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;script1 $1 $2 $3&lt;BR /&gt;script2 $4 $5 $6&lt;BR /&gt;script3 $1 $4 $5&lt;BR /&gt;script4 $7 $6 $5&lt;BR /&gt;&lt;BR /&gt;and running it as "wrapper a b c d e f g" would produce the input to the scripts as illustrated in the previous example.&lt;BR /&gt;&lt;BR /&gt;also note the following in my previous response:&lt;BR /&gt;"place all of the required input on the command line and parse that as needed using case or getops or???&lt;BR /&gt;&lt;BR /&gt;if the existing 4 scripts use command line arguments that will not change, then it is as simple as coding the call w/ the correct arguements in the correct order"&lt;BR /&gt;&lt;BR /&gt;note that getops / case statements allow you to do things like accept the various arguments "out of order" and assemble them in the correct fashion, something like &lt;BR /&gt;&lt;BR /&gt;wrapper -s server -d directory -or-&lt;BR /&gt;wrapper -d directory -s server &lt;BR /&gt;&lt;BR /&gt;would be equally as acceptable input&lt;BR /&gt;&lt;BR /&gt;if the above doesn't answer your questions, you're going to have to explain what about this has got you confused.  Posting a sample of what you've attempted to make work would be helpful.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Dec 2008 18:26:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327499#M671215</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-12-22T18:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327500#M671216</link>
      <description>what is the problem? how can you be confused? did you try to create your 'wrapper' script by just listing the commands in sequence? doesn't it work? scripts on unix are nothing more then what you would do on the command line, it's the same syntax, so what works there works in a script.</description>
      <pubDate>Tue, 23 Dec 2008 08:16:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327500#M671216</guid>
      <dc:creator>dirk dierickx</dc:creator>
      <dc:date>2008-12-23T08:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327501#M671217</link>
      <description>I did try by listing the script in sequence wiht parameters. My problem is parameters inside the script are not supposed to hard coded. Its supposed to give by user while running the wrapper and that means it can change user to user. so I am trying to find out the way here how can I pass parameters by wrapper script in such a way that its also can be used by the script inside it.&lt;BR /&gt;&lt;BR /&gt;Like for example&lt;BR /&gt;wrapper &lt;BR /&gt;script1 param1 param2 param3 param4&lt;BR /&gt;script2 param1 param2 param3&lt;BR /&gt;script3 param1 param2 param3 param4&lt;BR /&gt;script4 param1 param2&lt;BR /&gt;&lt;BR /&gt;all the scripts need parameter and it might be different or some of them may be the same. In this condition how can I pass parameter from wrapper.</description>
      <pubDate>Tue, 23 Dec 2008 15:17:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327501#M671217</guid>
      <dc:creator>pareshan</dc:creator>
      <dc:date>2008-12-23T15:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327502#M671218</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; all the scripts need parameter and it might be different or some of them may be the same. In this condition how can I pass parameter from wrapper.&lt;BR /&gt;&lt;BR /&gt;OldSchool has provided you a nicely detailed set of choices!&lt;BR /&gt;&lt;BR /&gt;You need to pass everything you need to your "wrapper".  Perhaps the first argument ($1) [or switch and argument] should identify which of the four scripts is to be run.  Then, the remaining arguments are applied as needed.&lt;BR /&gt;&lt;BR /&gt;Providing more details would be helpful.  I suggest you look at the manpages for 'sh-posix' and for 'getopts'.  There is actually a good example of how to use 'getopts' in those manpages.&lt;BR /&gt;&lt;BR /&gt;You could also benefit by looking at this site:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com/" target="_blank"&gt;http://www.shelldorado.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 23 Dec 2008 15:38:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327502#M671218</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-12-23T15:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327503#M671219</link>
      <description>"Those 4 scripts run fine individually and all of them require some parameters for to run"&lt;BR /&gt;&lt;BR /&gt;"Its a korn shell script and the script I am writting is not supposed to be interactive its supposted to be automated........Parameters should be passed to them in a command line (Positional Parameter)."&lt;BR /&gt;&lt;BR /&gt;"My problem is parameters inside the script are not supposed to hard coded"&lt;BR /&gt;==================================================================================&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Congratulations...you've stated yet a different requirement, maybe, possibly.&lt;BR /&gt;&lt;BR /&gt;DID YOU EVEN LOOK at the second example I posted?  Did you comprehend it?&lt;BR /&gt;&lt;BR /&gt;"if they vary, then you can either write a wrapper for each version, OR SOMETHING LIKE:&lt;BR /&gt;&lt;BR /&gt;THE WRAPPER IS:&lt;BR /&gt;========================&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;script1 $1 $2 $3&lt;BR /&gt;script2 $4 $5 $6&lt;BR /&gt;script3 $1 $4 $5&lt;BR /&gt;script4 $7 $6 $5&lt;BR /&gt;========================&lt;BR /&gt;and running it as "wrapper a b c d e f g" would produce the input to the scripts as illustrated....."  Note that $1 - $7 were the 7 parameters listed on the command line of "wrapper", and will be substituted in the appropriate places as follows(see next)&lt;BR /&gt;&lt;BR /&gt;========================&lt;BR /&gt;script1 a b c&lt;BR /&gt;script2 d e f&lt;BR /&gt;script3 a d e&lt;BR /&gt;script4 g f e&lt;BR /&gt;========================&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Then again, the statement "Its supposed to give by user while running the wrapper and that means it can change user to user" means that the existing scripts prompt then all you need is:&lt;BR /&gt;&lt;BR /&gt;script1&lt;BR /&gt;script2&lt;BR /&gt;script3&lt;BR /&gt;script4&lt;BR /&gt;&lt;BR /&gt;I don't understand the problem, as you are not clearly defining it. you've been provided examples which apply (or don't) to the questions as stated / when stated.  Whatever it isyou are trying to accomplish, it appears to be very basic, but communication of the real / actual requirements seems to be breaking down.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Dec 2008 15:44:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327503#M671219</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-12-23T15:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327504#M671220</link>
      <description>one more shot:&lt;BR /&gt;&lt;BR /&gt;given wrapper script:&lt;BR /&gt;script1 $1 $2 $3 &lt;BR /&gt;script2 $4 $5 $6 &lt;BR /&gt;script3 $1 $4 $5 &lt;BR /&gt;script4 $7 $6 $5 &lt;BR /&gt;======================== &lt;BR /&gt;and running it as "wrapper a b c d e f g"....&lt;BR /&gt;&lt;BR /&gt;the command line parameters of wrapper get mapped as follows:&lt;BR /&gt;&lt;BR /&gt;parm1 (a) of "wrapper" to script1/parm1 and script3/parm1,&lt;BR /&gt;parm2 (b) of "wrapper" to script1/parm2,&lt;BR /&gt;parm3 (c) of "wrapper" to script1/parm3,&lt;BR /&gt;parm4 (d) of "wrapper" to script2/parm1 and script3/parm2,&lt;BR /&gt;parm5 (e) of 'wrapper" to script2/parm2, script3/parm3 and script4/parm3,&lt;BR /&gt;parm6 (f) of "wrapper" to script4/parm2, and lastly&lt;BR /&gt;parm7 (g) of "wrapper" to script4/parm1&lt;BR /&gt;&lt;BR /&gt;note that the $2 used in "wrapper" means the second positional parameter on the command line of "wrapper" and doesn't relate to any of the $2's found in scripts1-4.  In script1-4, those $2's refer to the 2nd parameter on the shell script line where the given script is invoked.&lt;BR /&gt;&lt;BR /&gt;as a note on style...I wouldn't expect a user to get the parameters correct order, especially if there are more than just a couple of them.  I'd suggest you either gather all of the information required, either by prompting for the required stuff and storing it in a variable to be supplied when needed, or by implementing a strategy where the information contains some kind of options flag (see -d -s in previous examples).  This adds complexity to the code, but enhances usability.  However, given the problems to date, this may not be feasible....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Dec 2008 16:28:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327504#M671220</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-12-23T16:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327505#M671221</link>
      <description>Might be easier for you to:&lt;BR /&gt;cat script1 script2 script3 script4 &amp;gt; newscript</description>
      <pubDate>Wed, 24 Dec 2008 00:25:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327505#M671221</guid>
      <dc:creator>Mark McDonald_2</dc:creator>
      <dc:date>2008-12-24T00:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327506#M671222</link>
      <description>"Might be easier for you to:&lt;BR /&gt;cat script1 script2 script3 script4 &amp;gt; newscript"&lt;BR /&gt;&lt;BR /&gt;except that he appears to be saying each of the 4 scripts already rely on positional parameters to run....if he's already "confused", I wouldn't expect him to be able to sort out the fixes needed to make "newscript" run</description>
      <pubDate>Wed, 24 Dec 2008 12:43:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327506#M671222</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-12-24T12:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapper Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327507#M671223</link>
      <description>Thanks Old School, I have figured out somehow to do it using the most of the things you said but still its not complete so i dint close it yet.&lt;BR /&gt;thanks alot</description>
      <pubDate>Thu, 08 Jan 2009 20:25:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrapper-script/m-p/4327507#M671223</guid>
      <dc:creator>pareshan</dc:creator>
      <dc:date>2009-01-08T20:25:00Z</dc:date>
    </item>
  </channel>
</rss>

