how to use a bash function defined in your .bashrc with find -exec

Posted by sharrajesh on Stack Overflow See other posts from Stack Overflow or by sharrajesh
Published on 2010-06-16T20:06:35Z Indexed on 2010/06/16 21:42 UTC
Read the original article Hit count: 473

Filed under:
|
|
|

my .bashrc has the following function

function myfile {
 file $1
}
export -f myfile

it works fine when i call it directly

rajesh@rajesh-desktop:~$ myfile out.ogv 
out.ogv: Ogg data, Skeleton v3.0

it does not work when i try to invoke it through exec

rajesh@rajesh-desktop:~$ find ./ -name *.ogv -exec myfile {} \;
find: `myfile': No such file or directory

is there a way to call bash script functions with exec?

Any help is greatly appreciated.

Thanks, sharrajesh

© Stack Overflow or respective owner

Related posts about function

Related posts about find