For the RTOS I'm writing ( http://www.distortos.org ) I need to run find
as part of the build configuration process (from make menuconfig
target). For Windows I assume that user has MSYS2 installed, so find.exe
is available. The only problem with this particular file is that Windows also has such file in C:/Windows/system32
(supposedly it is something close to grep
). So depending on the order of folders in your PATH
environment variable you get one or the other if trying to call the file by just the name.
I've found that calling this program as /bin/find
from the Makefile
or in shell script works both in Windows and on (my) Linux. What is most important - doing it that way always calls find.exe
from MSYS2, no matter what is the order of folders in PATH
. So I'm wondering - is it OK to call find
this way, or maybe it is not portable and I just had luck that it works for me?
It would probably be more portable to refer to it as /usr/bin/find
. For example, on Fedora /bin
is actually a symlink to /usr/bin
, so either works:
bash-4.3$ ls -l /bin/find
-rwxr-xr-x. 1 root root 222608 Dec 28 18:26 /bin/find
bash-4.3$ ls -l /usr/bin/find
-rwxr-xr-x. 1 root root 222608 Dec 28 18:26 /usr/bin/find
But on a recent Ubuntu:
root@69ca68fbe5c0:/# ls -l /bin/find
ls: cannot access /bin/find: No such file or directory
root@69ca68fbe5c0:/# ls -l /usr/bin/find
-rwxr-xr-x. 1 root root 229992 Jan 6 2014 /usr/bin/find