<?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: script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851875#M275052</link>
    <description>ok, another question please why does it need a "!"?&lt;BR /&gt;&lt;BR /&gt;it says in the manual that the "!". "inverts the exit status of the command to which it is applied and it also inverts the meaning of the test operator"&lt;BR /&gt;&lt;BR /&gt;I am a bit confused. you can tell me to go back and read more if you like LOL LOL</description>
    <pubDate>Mon, 28 Aug 2006 21:13:37 GMT</pubDate>
    <dc:creator>nick massey</dc:creator>
    <dc:date>2006-08-28T21:13:37Z</dc:date>
    <item>
      <title>script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851871#M275048</link>
      <description>hi all, can some one please tell me what this is trying to do? I understand its looking for some thing inside the brackets but what specifically&lt;BR /&gt;&lt;BR /&gt;for i 'cat /foo/users.list' : do&lt;BR /&gt;if [[ ! -a $i ]] ; then&lt;BR /&gt;mkdir $i &lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;what is the "-a" doing too please</description>
      <pubDate>Mon, 28 Aug 2006 18:21:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851871#M275048</guid>
      <dc:creator>nick massey</dc:creator>
      <dc:date>2006-08-28T18:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851872#M275049</link>
      <description>The double brackets "[[ ]]" use the shell's (POSIX and Korn) internal expression evaluation and differ somewhat from the single brackets "[ ]" conditinal which invokes the external test command to evaluate the expression.&lt;BR /&gt;&lt;BR /&gt;To the internal evaluator "-a" says does a file exist? Thus, [[ ! -a ${i} ]] says if file ${i} does not exist then mkdir ${i}(and a file in UNIX is a regular file, a directory, a device node, ...).&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 18:46:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851872#M275049</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-28T18:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851873#M275050</link>
      <description>Oh, I should also note (to add to the confusion) that in single-bracket speak, "-a" is a logical AND but in double-bracket speak "&amp;amp;&amp;amp;" is the logical AND. Similarly "-o" (logical OR) becomes "||".&lt;BR /&gt;&lt;BR /&gt;The double-bracket is the the preferred approach these days because it is more efficient in that no external process need be fork()'ed and exec()'ed to do the expression evaluation.&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 18:49:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851873#M275050</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-28T18:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851874#M275051</link>
      <description>thanks very much for the speedy response, I get it..........I think LOL. I guess I need to RTFM more and do some testing. thanks very much :)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 19:21:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851874#M275051</guid>
      <dc:creator>nick massey</dc:creator>
      <dc:date>2006-08-28T19:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851875#M275052</link>
      <description>ok, another question please why does it need a "!"?&lt;BR /&gt;&lt;BR /&gt;it says in the manual that the "!". "inverts the exit status of the command to which it is applied and it also inverts the meaning of the test operator"&lt;BR /&gt;&lt;BR /&gt;I am a bit confused. you can tell me to go back and read more if you like LOL LOL</description>
      <pubDate>Mon, 28 Aug 2006 21:13:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851875#M275052</guid>
      <dc:creator>nick massey</dc:creator>
      <dc:date>2006-08-28T21:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851876#M275053</link>
      <description>Consider that /foo/users.list has the entries "Mickey","Minnie", and "Pluto".&lt;BR /&gt;&lt;BR /&gt;Also consider that in the CWD that directory (or file) Minnie already exists.&lt;BR /&gt;&lt;BR /&gt;The directory is only created if no such entry is found so the loop would create directories Mickey and Pluto but would not create Minnie because that directory already existed.&lt;BR /&gt;&lt;BR /&gt;In that sense the correct approach is "if file (directory) does not exist then make it".&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I should point out that there is actually a syntax error because you are missing an "fi".&lt;BR /&gt;&lt;BR /&gt;for i 'cat /foo/users.list' : do&lt;BR /&gt;if [[ ! -a $i ]] ; then&lt;BR /&gt;mkdir $i &lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;should be:&lt;BR /&gt;for i in 'cat /foo/users.list' &lt;BR /&gt;  do&lt;BR /&gt;    if [[ ! -a ${i} ]]&lt;BR /&gt;      then&lt;BR /&gt;        mkdir ${i}&lt;BR /&gt;      fi &lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;but because filenames can contain whitespace which would drive your for statement nuts, a better approach is something like this:&lt;BR /&gt;&lt;BR /&gt;typeset i=""&lt;BR /&gt;cat /foo/users.list | while read i&lt;BR /&gt;  do&lt;BR /&gt;    if [[ ! -a "${i}" ]]&lt;BR /&gt;      then&lt;BR /&gt;        mkdir "${i}"&lt;BR /&gt;      fi &lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;and the cat is superfluous as well since you could simply redirect stdin on the read itself but I left the cat in because it is closer to your original. Notice the quotes around "${i}" -- this means that directory "Mickey Mouse" is handled as one filename -- as it should be. Whitespace in UNIX filenames is perfectly legal although many scripts and programs will incorrectly handle it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 21:32:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851876#M275053</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-28T21:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851877#M275054</link>
      <description>aaaaaaaaaahhhhhhhh I see, this is very cool. &lt;BR /&gt;&lt;BR /&gt;I am starting to see the light, cool man.&lt;BR /&gt;&lt;BR /&gt;thanks very much.&lt;BR /&gt;&lt;BR /&gt;wicked &lt;BR /&gt;&lt;BR /&gt;cheers</description>
      <pubDate>Mon, 28 Aug 2006 21:41:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3851877#M275054</guid>
      <dc:creator>nick massey</dc:creator>
      <dc:date>2006-08-28T21:41:03Z</dc:date>
    </item>
  </channel>
</rss>

