<?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 Getting script input from another file. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448064#M769760</link>
    <description>Hello all, I am new to script programming and I have a question. I have an inherited script that gets information from a delimited file. Can anyone tell me what the signifigance of the folliwng lines are?&lt;BR /&gt;exec 5&amp;lt; /opt/security/os/eis2_fplus.data&lt;BR /&gt;&lt;BR /&gt;IFS=":"&lt;BR /&gt;while read -u5 userid first_name last_name / user_role&lt;BR /&gt;&lt;BR /&gt;The input data file looks like this...&lt;BR /&gt;&lt;BR /&gt;qf71701:Joe:Blow:users:admin&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;I'm wanting to run a daily script to add new users and I want to put all of the user specific information into a delimited file that will gwt sent over each night. Thanks.</description>
    <pubDate>Tue, 26 Sep 2000 16:55:22 GMT</pubDate>
    <dc:creator>Scott E Smith</dc:creator>
    <dc:date>2000-09-26T16:55:22Z</dc:date>
    <item>
      <title>Getting script input from another file.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448064#M769760</link>
      <description>Hello all, I am new to script programming and I have a question. I have an inherited script that gets information from a delimited file. Can anyone tell me what the signifigance of the folliwng lines are?&lt;BR /&gt;exec 5&amp;lt; /opt/security/os/eis2_fplus.data&lt;BR /&gt;&lt;BR /&gt;IFS=":"&lt;BR /&gt;while read -u5 userid first_name last_name / user_role&lt;BR /&gt;&lt;BR /&gt;The input data file looks like this...&lt;BR /&gt;&lt;BR /&gt;qf71701:Joe:Blow:users:admin&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;I'm wanting to run a daily script to add new users and I want to put all of the user specific information into a delimited file that will gwt sent over each night. Thanks.</description>
      <pubDate>Tue, 26 Sep 2000 16:55:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448064#M769760</guid>
      <dc:creator>Scott E Smith</dc:creator>
      <dc:date>2000-09-26T16:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting script input from another file.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448065#M769761</link>
      <description>1) exec 5&amp;lt; /opt/security/os/eis2_fplus.data &lt;BR /&gt;&lt;BR /&gt;This line opens an input stream (5) from the file /opt/security/os/eis2_fplus.data &lt;BR /&gt;&lt;BR /&gt;2) IFS=":" &lt;BR /&gt;&lt;BR /&gt;This line replaces the IFS variable (internal field separator: normally set to {space, tab, newline}) with the ":".  In other words, all input will be delimited by colon rather than whitespace.&lt;BR /&gt;&lt;BR /&gt;3) while read -u5 userid first_name last_name / user_role &lt;BR /&gt;&lt;BR /&gt;This line sets a while loop which reads the fields "userid" "first_name" etc. from the input stream denoted by identifier "5".</description>
      <pubDate>Tue, 26 Sep 2000 17:53:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448065#M769761</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2000-09-26T17:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting script input from another file.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448066#M769762</link>
      <description>So the occurrance of "5" is just a reference and doesn't hold any other significance?</description>
      <pubDate>Tue, 26 Sep 2000 17:55:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448066#M769762</guid>
      <dc:creator>Scott E Smith</dc:creator>
      <dc:date>2000-09-26T17:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting script input from another file.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448067#M769763</link>
      <description>Scott,&lt;BR /&gt;&lt;BR /&gt;Explained line by line:&lt;BR /&gt;&lt;BR /&gt;exec 5&amp;lt; /opt/security/os/eis2_fplus.data&lt;BR /&gt;-------&lt;BR /&gt;&lt;BR /&gt;The exec shell built-in in this form (without arguments) rearranges I/O redirection, In your case, it means that the file is attached to file descriptor 5.&lt;BR /&gt;&lt;BR /&gt;IFS=":"&lt;BR /&gt;-------&lt;BR /&gt;Set the IFS (Internal Field Separator) to the character ':'. The default IFS is whitespace, and is used to determine the boundaries between commands an options and arguments, to determine fields for some shell built-ins as read (as in your case).&lt;BR /&gt;&lt;BR /&gt;while read -u5 userid first_name last_name / user_role &lt;BR /&gt;------&lt;BR /&gt;&lt;BR /&gt;Read the next line from file descriptor 5 (that is connected to your file, remember), assigning the first field to the variable userid, the second field to the variable first_name and so forth.&lt;BR /&gt;&lt;BR /&gt;For more information on this and other shell magic, see the shell manpage (sh-posix(1)) or one of the O'Reilly books on shell scripting.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Rik.</description>
      <pubDate>Tue, 26 Sep 2000 17:58:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448067#M769763</guid>
      <dc:creator>RikTytgat</dc:creator>
      <dc:date>2000-09-26T17:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Getting script input from another file.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448068#M769764</link>
      <description>Scott:&lt;BR /&gt;&lt;BR /&gt;In reference to your question "So the occurrance of "5" is just a reference and doesn't hold any other significance?":&lt;BR /&gt;&lt;BR /&gt;'5' happened to be the file descriptor number chosen by the programmer for association with the file /opt/security/os/eis2_fplus.data.&lt;BR /&gt;&lt;BR /&gt;A file descriptor is a small unique, per-process, nonnegative integer identifier that is used to refer to a file opened for reading and/or writing. Each file descriptor refers to exactly one open file description.&lt;BR /&gt;&lt;BR /&gt;Remember '0' is standard-in (stdin), '1' is the file descriptor for standard-out (stdout), and '2' is the descriptor for standard-error (stderr).  The shell allows you to use values 3-9 to associate with any file of your choice.  A larger number of descriptors are available to C-programs.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 26 Sep 2000 23:41:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/getting-script-input-from-another-file/m-p/2448068#M769764</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-09-26T23:41:41Z</dc:date>
    </item>
  </channel>
</rss>

