<?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: test wheather at least one file exists in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964369#M4542</link>
    <description>My shell programming knowledge is very limited, but maybe this link will give you some hints:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.experts-exchange.com/Programming/Programming_Platforms/Unix_Programming/Q_20494418.html" target="_blank"&gt;http://www.experts-exchange.com/Programming/Programming_Platforms/Unix_Programming/Q_20494418.html&lt;/A&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 02 May 2003 08:24:53 GMT</pubDate>
    <dc:creator>Kjartan Maraas</dc:creator>
    <dc:date>2003-05-02T08:24:53Z</dc:date>
    <item>
      <title>test wheather at least one file exists</title>
      <link>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964368#M4541</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;When there is more then one file this failed on linux:&lt;BR /&gt;&lt;BR /&gt;if [ -f /folder/fileprefix*.filesuffix ]&lt;BR /&gt;&lt;BR /&gt;there is no problem with the syntax in HP-UX (ksh). Can you help me with the syntax?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Andrej</description>
      <pubDate>Fri, 02 May 2003 07:37:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964368#M4541</guid>
      <dc:creator>Andrej Vavro</dc:creator>
      <dc:date>2003-05-02T07:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: test wheather at least one file exists</title>
      <link>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964369#M4542</link>
      <description>My shell programming knowledge is very limited, but maybe this link will give you some hints:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.experts-exchange.com/Programming/Programming_Platforms/Unix_Programming/Q_20494418.html" target="_blank"&gt;http://www.experts-exchange.com/Programming/Programming_Platforms/Unix_Programming/Q_20494418.html&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 02 May 2003 08:24:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964369#M4542</guid>
      <dc:creator>Kjartan Maraas</dc:creator>
      <dc:date>2003-05-02T08:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: test wheather at least one file exists</title>
      <link>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964370#M4543</link>
      <description>Hi, Andrej you can try this, is a little mor complex but works,&lt;BR /&gt;&lt;BR /&gt;if (ls /folder/fileprefix*.filesuffix &amp;gt; /dev/null 2&amp;gt;&amp;amp;1) ; then echo HI ; fi&lt;BR /&gt;&lt;BR /&gt;Frank.</description>
      <pubDate>Fri, 02 May 2003 08:40:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964370#M4543</guid>
      <dc:creator>Francisco J. Soler</dc:creator>
      <dc:date>2003-05-02T08:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: test wheather at least one file exists</title>
      <link>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964371#M4544</link>
      <description>if [ -f /fs/filename ]&lt;BR /&gt;then&lt;BR /&gt;  echo "do something"&lt;BR /&gt;else&lt;BR /&gt;  echo "didn't find the file"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 02 May 2003 13:51:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964371#M4544</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-05-02T13:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: test wheather at least one file exists</title>
      <link>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964372#M4545</link>
      <description>Unfortunately, what you've described here is not the shell.&lt;BR /&gt;&lt;BR /&gt;You'll find on most Unix systems that the [ is a symboilc link to the program 'test' (but not all).&lt;BR /&gt;&lt;BR /&gt;'ksh' does do some fun things with scripts.  Unforunately 'ksh' (pdksh) on Linux does not behave in the exact same manner has 'ksh' on HP-UX (or SCO OSR which is what I was toying with).&lt;BR /&gt;&lt;BR /&gt;To achive what you are wanting to do, you'll have to resort to doing something like:&lt;BR /&gt;&lt;BR /&gt;if [ "$(echo *.blah)" != "*.blah" ]&lt;BR /&gt;&lt;BR /&gt;A strange work around, and admittadly not the best check (will match directories as well as symoblic links).&lt;BR /&gt;&lt;BR /&gt;You could always write your own shell function which looped through + counted arguments..</description>
      <pubDate>Sat, 03 May 2003 06:07:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964372#M4545</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2003-05-03T06:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: test wheather at least one file exists</title>
      <link>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964373#M4546</link>
      <description>to test for a file do:&lt;BR /&gt;if [ -f /home/name/file ]&lt;BR /&gt;&lt;BR /&gt;to test for a directory do:&lt;BR /&gt;if [ -d /home/directory ]&lt;BR /&gt;&lt;BR /&gt;to test for file permissions do:&lt;BR /&gt;if [ -r file ]&lt;BR /&gt;if [ -w file ]&lt;BR /&gt;if [ -x file ]&lt;BR /&gt;&lt;BR /&gt;to test if user owns a file do:&lt;BR /&gt;if [ -O file ] #capital letter o&lt;BR /&gt;&lt;BR /&gt;to test if a file exists and is non-empty do:&lt;BR /&gt;if [ -s file ]&lt;BR /&gt;&lt;BR /&gt;to test if sticky bit is set do:&lt;BR /&gt;if [ -k file ]&lt;BR /&gt;&lt;BR /&gt;to test if it is a symbolic link do:&lt;BR /&gt;if [ -L file ]&lt;BR /&gt;&lt;BR /&gt;to test if user is in the same group do:&lt;BR /&gt;if [ -G file ]&lt;BR /&gt;&lt;BR /&gt;There are several other "if" tests but I think this should cover almost any of your needs.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 05 May 2003 11:20:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/test-wheather-at-least-one-file-exists/m-p/2964373#M4546</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-05-05T11:20:19Z</dc:date>
    </item>
  </channel>
</rss>

