<?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 question - if file exists in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667510#M931902</link>
    <description>Sure:&lt;BR /&gt;&lt;BR /&gt;if [ -r ${FNAME} ]&lt;BR /&gt;  then&lt;BR /&gt;    echo "File ${FNAME} exists"&lt;BR /&gt;  else&lt;BR /&gt;    echo "File ${FNAME} not found"&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;man test for details.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 19 Feb 2002 16:19:02 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2002-02-19T16:19:02Z</dc:date>
    <item>
      <title>script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667508#M931900</link>
      <description>Is there any way in a shell script to check for the existence of a specific file?</description>
      <pubDate>Tue, 19 Feb 2002 16:16:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667508#M931900</guid>
      <dc:creator>Jim Mickens</dc:creator>
      <dc:date>2002-02-19T16:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667509#M931901</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Use the -e flag.&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;if [ -e $file ]&lt;BR /&gt;then&lt;BR /&gt;  echo $file exists&lt;BR /&gt;else&lt;BR /&gt;  echo $file does not exist&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Tue, 19 Feb 2002 16:18:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667509#M931901</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-02-19T16:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667510#M931902</link>
      <description>Sure:&lt;BR /&gt;&lt;BR /&gt;if [ -r ${FNAME} ]&lt;BR /&gt;  then&lt;BR /&gt;    echo "File ${FNAME} exists"&lt;BR /&gt;  else&lt;BR /&gt;    echo "File ${FNAME} not found"&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;man test for details.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Feb 2002 16:19:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667510#M931902</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-02-19T16:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667511#M931903</link>
      <description>in a while:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;while [ -f /tmp/file ] ;do &lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill</description>
      <pubDate>Tue, 19 Feb 2002 16:21:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667511#M931903</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-02-19T16:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667512#M931904</link>
      <description>Thanks to all.  I had a user ask me, and since I'd never tried it before, I had no idea.  I'll forward this info to him.</description>
      <pubDate>Tue, 19 Feb 2002 16:21:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667512#M931904</guid>
      <dc:creator>Jim Mickens</dc:creator>
      <dc:date>2002-02-19T16:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667513#M931905</link>
      <description>If you have the Unix In A Nutshell book, look at the page on test, it will give you about 20 different tests that you can use such as -f for file -x for executable file ...&lt;BR /&gt;&lt;BR /&gt;But -f should work for what you asked.&lt;BR /&gt;&lt;BR /&gt;GL,&lt;BR /&gt;C</description>
      <pubDate>Tue, 19 Feb 2002 16:22:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667513#M931905</guid>
      <dc:creator>Craig Rants</dc:creator>
      <dc:date>2002-02-19T16:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667514#M931906</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Check the attachment for all available condtional expressions.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Shiju</description>
      <pubDate>Tue, 19 Feb 2002 16:22:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667514#M931906</guid>
      <dc:creator>Helen French</dc:creator>
      <dc:date>2002-02-19T16:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667515#M931907</link>
      <description>use the test flags:&lt;BR /&gt;&lt;BR /&gt; -e = exists&lt;BR /&gt; -f = plain file&lt;BR /&gt; -r = readable file&lt;BR /&gt; -d = directory&lt;BR /&gt;&lt;BR /&gt;if [ -r file_name]; then&lt;BR /&gt;  (do stuff here)&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;mark</description>
      <pubDate>Tue, 19 Feb 2002 16:22:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667515#M931907</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2002-02-19T16:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667516#M931908</link>
      <description>Hi Jim,&lt;BR /&gt;&lt;BR /&gt;The following common flags can be used:&lt;BR /&gt;&lt;BR /&gt;-r file --&amp;gt; if file exists &amp;amp; is readable&lt;BR /&gt;-w file --&amp;gt; if file exists &amp;amp; is writable&lt;BR /&gt;-x file --&amp;gt; if file exists &amp;amp; is executable&lt;BR /&gt;-f file --&amp;gt; if file exists &amp;amp; is not a directory&lt;BR /&gt;-d file --&amp;gt; if file exists &amp;amp; is a directory&lt;BR /&gt;-s file --&amp;gt; if file exists &amp;amp; size &amp;gt; 0&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin</description>
      <pubDate>Tue, 19 Feb 2002 16:24:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667516#M931908</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-02-19T16:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: script question - if file exists</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667517#M931909</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;man ksh says it all..&lt;BR /&gt;&lt;BR /&gt;-Shabu</description>
      <pubDate>Tue, 19 Feb 2002 18:28:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question-if-file-exists/m-p/2667517#M931909</guid>
      <dc:creator>SHABU KHAN</dc:creator>
      <dc:date>2002-02-19T18:28:21Z</dc:date>
    </item>
  </channel>
</rss>

