Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

'find' command inconsistency

Tags
shell scripts

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 06-11-2010
'find' command inconsistency

I am seeing a strange behavior of the 'find' command on AIX. As you can see,
the find command sometimes finds the file and sometimes does not based on how
many characters I specified between the wildcards.

I know all of these issues
can be resolved by using double quotes like "*est*". But I am posting this to
see if any of you can explain why it is able to find the file when I
specified *estf* but could not when I used *est*.

Code:
/home/testuser>uname -a

AIX myhost 3 5 00080B19D600

/home/testuser>ls -al /tmp/testuser

-rw-r--r--    1 testuser   staff             0 Jun 09 17:29 testfile

/home/testuser>find /tmp/testuser -name *est*


/home/testuser>find /tmp/testuser -name *estf*
/tmp/testuser/testfile

# 2  
Old 06-11-2010
Hi.

Rerun both commands, but with echo in front of each one ... cheers, drl
# 3  
Old 06-11-2010
The find util has co-dependency issues and likes its globbed args to be held...preferably between double-quotes.

Seriously, it does not always behave as expected on globbed -name args. You'll want to make sure and wrap your args in proper quotes to ensure that find can parse them properly.
Code:
find /tmp/testuser -name *est*   -o -name *estf* 
# versus ... 
find /tmp/testuser -name "*est*" -o -name "*estf*"

# 4  
Old 06-12-2010
The find command has no inconsistencies. If you don't quote parameters containing wildcards, they will be expanded before being passed to the find command if they match some existing filename. This is certainly true with your case.
As drl already wrote: echo will show you the root cause and demonstrate find isn't the issue here.
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Inconsistency with parallel run arunkumar_mca Linux 7 11-06-2017 12:16 PM
Svccfg listprop, inconsistency in service property javanoob Solaris 0 03-30-2016 05:12 AM
VCS Crashing due to inconsistency in opt (managed by VxvM) aji1729 Solaris 1 05-10-2012 01:22 PM
file system inconsistency venikathir Red Hat 3 11-24-2011 07:53 AM
Inconsistency between passwd and group Norgaard UNIX for Dummies Questions & Answers 1 07-01-2011 10:09 AM
Variable value inconsistency on BASH and CSH pavanlimo Shell Programming and Scripting 2 04-08-2009 11:48 AM
File System inconsistency callitdctr UNIX for Dummies Questions & Answers 3 04-03-2009 03:22 AM
Backspace stty inconsistency Runrig HP-UX 1 06-30-2008 09:40 AM
packet inconsistency problem clalfa Ubuntu 1 03-17-2008 04:53 PM
Disk inconsistency Carmen123 UNIX for Dummies Questions & Answers 1 11-20-2006 10:10 AM


All times are GMT -4. The time now is 01:23 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password