I’m a bit confuzzled at this point, & I’m wondering if anybody can explain this situation to me.
I’ve SSH'd into my Synology NAS, which runs BusyBox (see http://en.wikipedia.org/wiki/BusyBox). You can also install GNU tools using a package manager called ipkg. I recently tried to use the find command to do a common query & got this: # find . -size +10M find: invalid number '10M' What the heck? That should work just fine. What’s going on with find? # ls -l /usr/bin/find /usr/bin/find -> ../../bin/busybox* * (Sidenote #1: ../../bin is really just /bin.) (Sidenote #2: Some of you may wonder why find is a soft link to busybox. According to the Wikipedia article on BusyBox: > Programs included in BusyBox can be run simply by adding their name as an argument to the BusyBox executable: > /bin/busybox ls > More commonly, the desired command names are linked (using [hard] or [symbolic] links) to the BusyBox executable; BusyBox notices the name it is called as, and runs the appropriate command, for example just > /bin/ls > after /bin/ls is linked to /bin/busybox. End sidenote #2.) Aha! The version of find that came with BusyBox was not up to the task, so I installed the GNU version of find using ipkg: # ipkg install findutils Installing findutils (4.2.32-1) to root... Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/findutils_4.2.32-1_arm.ipk Configuring findutils update-alternatives: Linking //opt/bin/find to /opt/bin/findutils-find update-alternatives: Linking //opt/bin/xargs to /opt/bin/findutils-xargs Successfully terminated. I now tried my find command again: # find . -size +10M find: invalid number '10M' Same thing. Huh. OK, which find is being used? # which find /opt/bin/find That’s the one installed by ipkg: the GNU version. Let me take a look at that command ... # ls -l /opt/bin/find /opt/bin/find -> /opt/bin/findutils-find OK, it’s a soft link pointing to findutils-find in that same directory. Does *that* work? # findutils-find . -size +10M ./18 - Revolution Rock.mp3 What about calling the GNU find via the full path? # /opt/bin/find . -size +10M ./18 - Revolution Rock.mp3 That works too. Now, I know what many of you are thinking: check your PATH, dummy! So I did: # echo $PATH /opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin Notice how /opt/bin is BEFORE /usr/bin, & is also before /bin, which is where the busybox executable resides. So shouldn’t /opt/bin/find get called when I just type in find? And to make things even weirder, I saw this: # type find find is hashed (/usr/bin/find) I was expecting when I entered `type find` to see it refer to the the type at /opt/bin/find, but maybe that’s a wrong expectation on my part. So, here’s my question: when I enter find, why is /usr/bin/find being used instead of /opt/bin/find, even though my PATH indicates that the reverse should be true? Tks! Scott -- R. Scott Granneman [email protected] ~ www.granneman.com ~ granneman.tel Full list of publications @ http://www.granneman.com/publications My latest book: Mac OS X for Power Users @ http://www.granneman.com/books “Most people are bothered by those passages of Scripture they do not understand, but the passages that bother me are those I do understand.” ---Mark Twain -- -- Central West End Linux Users Group (via Google Groups) Main page: http://www.cwelug.org To post: [email protected] To subscribe: [email protected] To unsubscribe: [email protected] More options: http://groups.google.com/group/cwelug --- You received this message because you are subscribed to the Google Groups "Central West End Linux Users Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
