Re: bash - executing function in find command

2005-07-06 Thread Paul Smith
%% Dexter [EMAIL PROTECTED] writes: find . | while read file; do do something with $file; done d I tried before something like: d F=$(find .);for I in $F;do do something with $I; done Besides breaking on filenames with embedded whitespace, this method has the other major disadvantage

Re: bash - executing function in find command

2005-07-06 Thread Chris F.A. Johnson
On 2005-07-06, Paul Smith wrote: The disadvantage of the pipe-to-while method is that each element in the pipeline is run in a subshell, so variables set inside the while loop (for example) won't be set after the loop is complete[*]. find . | { while read line do : whatever

Re: bash - executing function in find command

2005-07-06 Thread Paul Smith
%% Chris F.A. Johnson [EMAIL PROTECTED] writes: cfaj On 2005-07-06, Paul Smith wrote: The disadvantage of the pipe-to-while method is that each element in the pipeline is run in a subshell, so variables set inside the while loop (for example) won't be set after the loop is

bash - executing function in find command

2005-07-05 Thread Dexter
Hi, bash command find let's you execute other commands like this: $find . -exec commandname {} param1 param2 \; This should do: for each file in actual directory tree run: $commandname filename param1 param2 ({} stands for filename) So far I understood it from manuals and it's running as I want.

Re: bash - executing function in find command

2005-07-05 Thread Gregory Seidman
On Wed, Jul 06, 2005 at 12:44:25AM +0200, Dexter wrote: } Hi, } bash command find let's you execute other commands like this: [...] This is where your problem comes up. The find command is a standalone program, and unrelated to bash. } Somebody has a idea how to run function there? This is what

Re: bash - executing function in find command

2005-07-05 Thread Paul Smith
%% Dexter [EMAIL PROTECTED] writes: d But I want to use bash function instead of command. You can't. d Problem is not, that command find runs in different environment, and d doesn't know variables and functions from parent shell. Yes it is. d Because i tried: d A=XXX d $find .

Re: bash - executing function in find command

2005-07-05 Thread Dexter
On Tue, 2005-07-05 at 18:53 -0400, Paul Smith wrote: %% Dexter [EMAIL PROTECTED] writes: d But I want to use bash function instead of command. You can't. d Problem is not, that command find runs in different environment, and d doesn't know variables and functions from parent