[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gNewSense-users] Strange find behavior

From: Matthew Flaschen
Subject: [gNewSense-users] Strange find behavior
Date: Fri, 30 Mar 2007 02:29:32 -0400
User-agent: Thunderbird (X11/20070306)

This isn't really at all gnewsense-specific, but...:

Can anyone explain this:

find -name "*.c" -exec basename '{}' .c \;

find -name "*.c" -exec echo $(basename '{}' .c) \;

Shouldn't they do the same thing by definition?  I could have sworn the
below command used to work:

find -name "*.c" -exec mv {} $(basename '{}' .c).cpp \;

I would expect this to rename test.c test.cpp and test2.c test2.cpp .
Now it changes test.c to test.c.cpp and test2.c to test2.cpp, consistent
with the above.

Alternatively, if I'm way off track, how can I do this (preferably just
find and basename and without a shell script). I've been reading the
UNIX-Haters Handbook and it's starting to get to me...

I almost want to think find is pulling some sort of security shenanigans
(even though I'm using exec not execdir).  I do know findutils has been
changed since I last tried this, so perhaps they really did break
something (doubtful).


Matt Flaschen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]