So I installed GNU find via homebrew. I then created an alias called "find" and pointed it to GNU find.
My problem is that inside a script (tried bash and ZSH), the script always wants to use the find command supplied by Apple when I use the "find" command.
Any ideas on how to fix? Thank you.
This is my sample script
This is the output of the script
Code:
~
➜ alias | grep find
find=/usr/local/bin/gfind
tree='find . -print | sed -e '\''s;[^/]*/;|____;g;s;____|; |;g'\'
~
➜ which find
find: aliased to /usr/local/bin/gfind
~
➜ find --version
find (GNU findutils) 4.7.0
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)
Any ideas on how to fix? Thank you.
This is my sample script
Code:
#!/bin/bash
source ~/Documents/environment-setup.sh
alias | grep find
which find
echo "running find --version"
find --version
echo "running gfind --version"
gfind --version
Code:
~
➜ ./test.sh
alias find='/usr/local/bin/gfind'
/usr/bin/find
running find --version
find: illegal option -- -
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
running gfind --version
find (GNU findutils) 4.7.0
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)