<?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: providing a shell script with parameters from a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095650#M145809</link>
    <description>dear Graham,&lt;BR /&gt;could you please tell me what structure a text file should have?&lt;BR /&gt;e.g each variable in  separate line?&lt;BR /&gt;</description>
    <pubDate>Fri, 17 Oct 2003 03:11:10 GMT</pubDate>
    <dc:creator>Maciej Szewczykowski</dc:creator>
    <dc:date>2003-10-17T03:11:10Z</dc:date>
    <item>
      <title>providing a shell script with parameters from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095646#M145805</link>
      <description>hello all.&lt;BR /&gt;got a question. i've written a script which contains several variables. because i'd like to run a script each time with different variables values, the most convenient solution seems to be storing the values in a text file. is it possible that a script takes values for it's variables from a file (e.g. using '&amp;lt;' operator)?&lt;BR /&gt;thank you in advance.&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Oct 2003 02:07:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095646#M145805</guid>
      <dc:creator>Maciej Szewczykowski</dc:creator>
      <dc:date>2003-10-17T02:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: providing a shell script with parameters from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095647#M145806</link>
      <description>why don't you source the file depending on the arguments supplied:&lt;BR /&gt;&lt;BR /&gt;ie&lt;BR /&gt;&lt;BR /&gt;./script -op&lt;BR /&gt;sources file operator.env&lt;BR /&gt;and&lt;BR /&gt;./script -ad&lt;BR /&gt;sources file admin.env&lt;BR /&gt;&lt;BR /&gt;where admin.env contains&lt;BR /&gt;export VARIABLE1=one&lt;BR /&gt;export VARIABLE2=two&lt;BR /&gt;&lt;BR /&gt;etc&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Oct 2003 02:20:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095647#M145806</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2003-10-17T02:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: providing a shell script with parameters from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095648#M145807</link>
      <description>You store variables into a plain file like this;&lt;BR /&gt;&lt;BR /&gt;VAR1=&lt;VARIABLE&gt;&lt;BR /&gt;STRING1=&lt;TEXT&gt;&lt;BR /&gt;&lt;BR /&gt;Then you source this file with . &lt;FILENAME&gt;&lt;BR /&gt;eg. put these 2 lines above into a file called VARIABLES then from your shell or from a script do;&lt;BR /&gt;. ./VARIABLES&lt;BR /&gt;This then sources the file and sets up these variables exactly as the are in the file, you can then run your script using these variables.&lt;BR /&gt;&lt;/FILENAME&gt;&lt;/TEXT&gt;&lt;/VARIABLE&gt;</description>
      <pubDate>Fri, 17 Oct 2003 02:21:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095648#M145807</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2003-10-17T02:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: providing a shell script with parameters from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095649#M145808</link>
      <description>Yes it's possible, but I wouldn't use "&amp;lt;" here.&lt;BR /&gt;Within your script, positional parameters are referenced as $1, $2 etc, with $0 the whole line.&lt;BR /&gt;You can run your script based on the contents of textfile, a line at a time, using the following shell command:&lt;BR /&gt;--&lt;BR /&gt;while read line&lt;BR /&gt;        do&lt;BR /&gt;        yourscript.sh "$line"&lt;BR /&gt;done &amp;lt; textfile&lt;BR /&gt;--&lt;BR /&gt;Note the double quotes are needed around "$line" to get the whole line into the script, without them you'd only get the first parameter, not the entire line.&lt;BR /&gt;-- Graham</description>
      <pubDate>Fri, 17 Oct 2003 02:22:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095649#M145808</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-17T02:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: providing a shell script with parameters from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095650#M145809</link>
      <description>dear Graham,&lt;BR /&gt;could you please tell me what structure a text file should have?&lt;BR /&gt;e.g each variable in  separate line?&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Oct 2003 03:11:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095650#M145809</guid>
      <dc:creator>Maciej Szewczykowski</dc:creator>
      <dc:date>2003-10-17T03:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: providing a shell script with parameters from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095651#M145810</link>
      <description>It depends on the variable values. For instance, if there is a formula for some of them, put that formula in your script instead of creating the parameter file by hand. Or create the parameter file with a script.&lt;BR /&gt;&lt;BR /&gt;If you have a parameter file, make sure it contains all variables for one instance on one line. Then you can do it using the command read.&lt;BR /&gt;&lt;BR /&gt;It will look something like this:&lt;BR /&gt;while read parm1 parm2 parm3 ...&lt;BR /&gt;do&lt;BR /&gt;      do_actions&lt;BR /&gt;done &amp;lt; param_file&lt;BR /&gt;&lt;BR /&gt;Good luck</description>
      <pubDate>Fri, 17 Oct 2003 04:38:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095651#M145810</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2003-10-17T04:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: providing a shell script with parameters from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095652#M145811</link>
      <description>To quote the venerable A. Clay Stephenson, "it depends". In fact it's entirely up to you.&lt;BR /&gt;There are loads of examples on the system.&lt;BR /&gt;&lt;BR /&gt;For example, have a look at&lt;BR /&gt;"/usr/sam/lbin/ioparser.sh" around line 474, where 19 variables are read from a single line.&lt;BR /&gt;--&lt;BR /&gt;-- Graham</description>
      <pubDate>Fri, 17 Oct 2003 04:41:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/providing-a-shell-script-with-parameters-from-a-file/m-p/3095652#M145811</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-17T04:41:56Z</dc:date>
    </item>
  </channel>
</rss>

