Re: find with -exec option using complex expressions
From: Bill Marcum (bmarcum_at_iglou.com)
Date: 07/26/04
- Next message: Fred: "using compress with cpio"
- Previous message: jahurt_at_hotmail.com: "Re: access to clipboard in X?"
- In reply to: Jim: "find with -exec option using complex expressions"
- Next in thread: rakesh sharma: "Re: find with -exec option using complex expressions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Jul 2004 20:11:27 -0400
On 25 Jul 2004 09:55:05 -0700, Jim
<shija03@hotmail.com> wrote:
> Hello,
>
> I am trying to execute a "find . -exec 'somecomplex expression'
> \;", but I am failing to make it work. Can anyone help me, here is my
> example:
>
> find . -exec \( myvar={};newvar=`basename {}`;touch /here/${newvar}
> \)\;
> or
> find . -exec \( "myvar={};newvar=`basename {}`;touch
> /here/${newvar}" \)\;
>
"find -exec" does not invoke a shell unless you explicitly give a command
such as
find . -exec sh -c 'echo "This is $1"' find {} \;
When I tried this, it ran very slowly. You might want to rewrite your
script as:
find . -print | while read myvar; do
newvar=`basename "$myvar"`
touch "/here/${newvar}"
done
-- "Donna Hand of Ashburn, Va., waited five hours to see the casket and spent about three minutes inside." --AP news story
- Next message: Fred: "using compress with cpio"
- Previous message: jahurt_at_hotmail.com: "Re: access to clipboard in X?"
- In reply to: Jim: "find with -exec option using complex expressions"
- Next in thread: rakesh sharma: "Re: find with -exec option using complex expressions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|