<?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 How do I check whether a file exists using Shell Script ? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061953#M719282</link>
    <description>How do I check whether a file exists in current directory and in a particular directory ?&lt;BR /&gt;e.g. &lt;BR /&gt;I like to see whether a file called a.txt exists in current directory ?&lt;BR /&gt;I like to see whether a file called a.txt exists in ..\temp directory ?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
    <pubDate>Tue, 02 Sep 2003 21:22:58 GMT</pubDate>
    <dc:creator>Praveen Hari</dc:creator>
    <dc:date>2003-09-02T21:22:58Z</dc:date>
    <item>
      <title>How do I check whether a file exists using Shell Script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061953#M719282</link>
      <description>How do I check whether a file exists in current directory and in a particular directory ?&lt;BR /&gt;e.g. &lt;BR /&gt;I like to see whether a file called a.txt exists in current directory ?&lt;BR /&gt;I like to see whether a file called a.txt exists in ..\temp directory ?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Sep 2003 21:22:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061953#M719282</guid>
      <dc:creator>Praveen Hari</dc:creator>
      <dc:date>2003-09-02T21:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check whether a file exists using Shell Script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061954#M719283</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;To see if a file called 'a.txt' exists, do:&lt;BR /&gt;&lt;BR /&gt;if [ -f a.txt ]; then&lt;BR /&gt;echo "I exist!"&lt;BR /&gt;else&lt;BR /&gt;echo "I exist not!"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;See the man pages for 'test(1}'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 02 Sep 2003 21:27:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061954#M719283</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-09-02T21:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check whether a file exists using Shell Script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061955#M719284</link>
      <description>#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;FNAME="./a.txt"&lt;BR /&gt;if [[ -f "${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;FNAME="../temp/a.txt"&lt;BR /&gt;&lt;BR /&gt;# now same as above&lt;BR /&gt;&lt;BR /&gt;This actually tests to see if the file exists and is a regular file. Man test for details.&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Sep 2003 21:28:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061955#M719284</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-09-02T21:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check whether a file exists using Shell Script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061956#M719285</link>
      <description>Chek out "test"&lt;BR /&gt;&lt;BR /&gt;Things like &lt;BR /&gt;&lt;BR /&gt;if test -e filename&lt;BR /&gt;then&lt;BR /&gt;&lt;BR /&gt;THis will check it exists.  You can use [ instead of test so&lt;BR /&gt;&lt;BR /&gt;if [ -e filename ]&lt;BR /&gt;then&lt;BR /&gt;&lt;BR /&gt;works or you can just miss out the "if" as in&lt;BR /&gt;&lt;BR /&gt;[ -e filename ] &amp;amp;&amp;amp; {&lt;BR /&gt; your command go&lt;BR /&gt; here&lt;BR /&gt;}</description>
      <pubDate>Tue, 02 Sep 2003 21:29:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061956#M719285</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-09-02T21:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check whether a file exists using Shell Script ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061957#M719286</link>
      <description>Caution: using [ -e filename ] does not work on standard HPUX.&lt;BR /&gt;&lt;BR /&gt;-e is is only available in newer shell versions</description>
      <pubDate>Wed, 03 Sep 2003 14:38:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-check-whether-a-file-exists-using-shell-script/m-p/3061957#M719286</guid>
      <dc:creator>Scot Bean</dc:creator>
      <dc:date>2003-09-03T14:38:02Z</dc:date>
    </item>
  </channel>
</rss>

