<?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: unexpected behaviour with find command. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830856#M938176</link>
    <description>You would have the same problem without the -o (or) so let's ignore that. The real problem is that the shell is globbing the filenames. The -name arguments expects exactly one argument but if there is more than one file in your current directory that will match *.ksh then find has a syntax error. The solution is rather simple; instruct the sheel to do no filename expansion by surrounding your -name argument with quotes - e.g -name '*.ksh'.</description>
    <pubDate>Tue, 22 Oct 2002 13:57:26 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2002-10-22T13:57:26Z</dc:date>
    <item>
      <title>unexpected behaviour with find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830853#M938173</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;When i search for *.ksh and *.sh files from my home directory in another directory the result is as expected but when i do the same search from one of the sub-directory in my home directory it gives no result. However if i search for full filename (Eg. test1.ksh) it just works fine.&lt;BR /&gt;&lt;BR /&gt;Depicted below is the problem in commands.&lt;BR /&gt;&lt;BR /&gt;#pwd&lt;BR /&gt;/home/users/rajeev&lt;BR /&gt;#find /home/prod \( -name *.ksh -o -name *.sh \) &lt;BR /&gt;find: cannot open /home/prod/test1&lt;BR /&gt;/home/prod/test/test1.ksh&lt;BR /&gt;/home/prod/test/test_test1.ksh&lt;BR /&gt;#cd sub&lt;BR /&gt;#pwd&lt;BR /&gt;/home/users/rajeev/sub&lt;BR /&gt;#find /home/prod \( -name *.ksh -o -name *.sh \) &lt;BR /&gt;find: cannot open /home/prod/test1&lt;BR /&gt;Reports nothing.&lt;BR /&gt;#find /home/prod -name test1.ksh&lt;BR /&gt;/home/prod/test/test1.ksh&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;However "ls -ltR /home/prod" from this sub-directory works fine. &lt;BR /&gt;Any help in this case would be appreiciated.</description>
      <pubDate>Tue, 22 Oct 2002 13:43:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830853#M938173</guid>
      <dc:creator>Rajeev Tyagi</dc:creator>
      <dc:date>2002-10-22T13:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: unexpected behaviour with find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830854#M938174</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The problem is that shell expands meta characters BEFORE executing commands, so *.ksh is expanded if possible into current list of .ksh files if they exist in current dir before executing find. You should better use :&lt;BR /&gt;&lt;BR /&gt;#find /home/prod \( -name \*.ksh -o -name \*.sh \) &lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;#find /home/prod \( -name '*.ksh' -o -name '*.sh' \) &lt;BR /&gt;&lt;BR /&gt;Juste to avoid expansion ...&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Jean-Louis.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Oct 2002 13:50:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830854#M938174</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2002-10-22T13:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: unexpected behaviour with find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830855#M938175</link>
      <description>Try putting the *.ksh and *.sh within quotes:&lt;BR /&gt;'*.ksh' and '*.sh'. This is a good practise to follows whenever you use the find command.</description>
      <pubDate>Tue, 22 Oct 2002 13:57:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830855#M938175</guid>
      <dc:creator>Helen French</dc:creator>
      <dc:date>2002-10-22T13:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: unexpected behaviour with find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830856#M938176</link>
      <description>You would have the same problem without the -o (or) so let's ignore that. The real problem is that the shell is globbing the filenames. The -name arguments expects exactly one argument but if there is more than one file in your current directory that will match *.ksh then find has a syntax error. The solution is rather simple; instruct the sheel to do no filename expansion by surrounding your -name argument with quotes - e.g -name '*.ksh'.</description>
      <pubDate>Tue, 22 Oct 2002 13:57:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830856#M938176</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-10-22T13:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: unexpected behaviour with find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830857#M938177</link>
      <description>&lt;BR /&gt;I'd add that you should escape-out the PERIOD also:&lt;BR /&gt;&lt;BR /&gt;find /home/prod -type f -name "*\\.ksh" -o -name "*\\.sh"&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 22 Oct 2002 14:06:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830857#M938177</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-10-22T14:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: unexpected behaviour with find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830858#M938178</link>
      <description>oops, I thought the submit would mess with the back-slashes:&lt;BR /&gt;&lt;BR /&gt;find /tmp -type f -name "*\.ksh" -o -name "*\.sh"&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 22 Oct 2002 14:07:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830858#M938178</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-10-22T14:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: unexpected behaviour with find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830859#M938179</link>
      <description>Thanks for the immediate response. I tried them and it worked.</description>
      <pubDate>Tue, 22 Oct 2002 14:12:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unexpected-behaviour-with-find-command/m-p/2830859#M938179</guid>
      <dc:creator>Rajeev Tyagi</dc:creator>
      <dc:date>2002-10-22T14:12:52Z</dc:date>
    </item>
  </channel>
</rss>

