|
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 go.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 do mv "$f" "${f%.cpp}.c" doneThanks. 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 <http://cfaj.freeshell.org> ========= Do not reply to the From: address; use Reply-To: ======== Author: Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
[Prev in Thread] | Current Thread | [Next in Thread] |