[Top][All Lists]

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

Re: [gNewSense-users] Strange find behavior

From: Chris F.A. Johnson
Subject: Re: [gNewSense-users] Strange find behavior
Date: Sat, 31 Mar 2007 14:52:42 -0400 (EDT)

On Sat, 31 Mar 2007, Matthew Flaschen wrote:

Chris F.A. Johnson wrote:
On Fri, 30 Mar 2007, Matthew Flaschen wrote:

Chris F.A. Johnson wrote:
   The basename command is executed and the result is placed  on the
   command line. What you are running is:

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

Thank you.  I should have figured that out.

   Why don't you want to use a script? That's the logical way to do it.

If I made a full-out script myself, I'll have to remake it everywhere I

   Why? Write one script that works everywhere.

I'll still have to copy it everywhere, since it isn't standard.

   Write a script to do that. ;)

   Also, you don't need basename; it's an external command (i.e.,
   slow) which the shell replaces with built-in parameter expansion.

for f in *.cpp
   mv "$f" "${f%.cpp}.c"

Thanks.  That '%' syntax will take getting used to, though.

   If you do any amount of shell scripting, learn the POSIX parameter
   expansions. They make scripts MUCH faster.

   Chris F.A. Johnson                      <>
   ========= Do not reply to the From: address; use Reply-To: ========
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

reply via email to

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