maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   N900: find does not know -exec (https://talk.maemo.org/showthread.php?t=62292)

ME2g 2010-09-14 21:12

N900: find does not know -exec
 
I am using Maemo 5, Version 10.2010.19-1 on N900.

When doing a
find . -type f -exec grep "somthing" {} \;
then I get an error message
"find: unrecognized: -exec"

Is the find command different on ash?
Documentation says that it is the same.

slender 2010-09-14 21:17

Re: N900: find does not know -exec
 
btw. itīs not bash (you can install it) itīs busybox and also you can install find separately IIRC.

j.s 2010-09-14 21:17

Re: N900: find does not know -exec
 
Quote:

Originally Posted by ME2g (Post 816258)
I am using Maemo 5, Version 10.2010.19-1 on N900.

When doing a
find . -type f -exec grep "somthing" {} \;
then I get an error message
"find: unrecognized: -exec"

Is the find command different on ash?
Documentation says that it is the same.

On the n900, find is provided by busybox, which likely does not provide the -exec option to find.

linuxeventually 2010-09-14 21:19

Re: N900: find does not know -exec
 
The N900 comes with busybox. Busybox doesn't use the GNU coreutils utilities/commands instead it has watered downed versions with less features. BASH vs ASH is mostly syntax related.

Install this: http://maemo.org/packages/view/coreutils-gnu/
Or simply compile coreutils in scratchbox yourself and copy over the binary find command.

Woops find is not part of coreutils but instead findutils.

ME2g 2010-09-14 21:25

Re: N900: find does not know -exec
 
Thanks.

Does "findutils-gnu v4.4.2-1maemo7"
http://maemo.org/downloads/product/M...findutils-gnu/
also do the trick?

daperl 2010-09-14 21:41

Re: N900: find does not know -exec
 
That's probably why they put xargs in findutils.

busybox find + xargs = good

lma 2010-09-14 22:15

Re: N900: find does not know -exec
 
Quote:

Originally Posted by daperl (Post 816285)
That's probably why they put xargs in findutils.

Indeed, piping to xargs is generally a much better option than -exec.

Quote:

busybox find + xargs = good
I think you'll find it's not, the Maemo busybox is configured with support for find -print0 but not xargs -0 :-(

cpitchford 2010-09-14 22:38

Re: N900: find does not know -exec
 
Xargs is nice.. but... Shell is pretty versatile

Code:

find / -some-options | while IFS="" read file ; do echo "Found file: $file" ; done
Remember to enclose "$file" in double-quotes..

daperl 2010-09-14 23:15

Re: N900: find does not know -exec
 
Quote:

Originally Posted by lma (Post 816318)
I think you'll find it's not, the Maemo busybox is configured with support for find -print0 but not xargs -0 :-(

So true, but lucky me, I have yet to come across an n900 file name of interest that has spaces or newlines.

lma 2010-09-14 23:24

Re: N900: find does not know -exec
 
Quote:

Originally Posted by cpitchford (Post 816338)
Xargs is nice.. but... Shell is pretty versatile

True, and even a read loop is going to be faster than -exec anyway (though a bit more verbose to type). For anything more advanced one can always pull out File::Find.


All times are GMT. The time now is 15:05.

vBulletin® Version 3.8.8