find: What's up with basename and dirname?

Posted by temp2290 on Stack Overflow See other posts from Stack Overflow or by temp2290
Published on 2010-03-11T21:00:12Z Indexed on 2010/03/11 21:04 UTC
Read the original article Hit count: 177

Filed under:
|
|
|

I'm using find for a task and I noticed that when I do something like this:

find `pwd` -name "file.ext" -exec echo $(dirname {}) \;

it will give you dots only for each match. When you s/dirname/basename in that command you get the full pathnames. Am I screwing something up here or is this expected behavior? I'm used to basename giving you the name of the file (in this case "file.ext") and dirname giving you the rest of the path.

© Stack Overflow or respective owner

Related posts about unix

Related posts about linux