On Tue, Nov 22, 2022 at 3:40 PM Rebecca Cran <quic_rc...@quicinc.com> wrote:
> On 11/21/22 15:22, Pedro Falcato wrote: > > > I kind of dislike your solution. Does NetBSD ship /bin/which by default? > > I think replacing whereis with "which -a" would be a lot better. > > I don't think there's a 100% standard way to do this in POSIX, as which > > isn't POSIX either, and your solution seems... hacky? > > > "command" seems to be the POSIX way to do this? > https://pubs.opengroup.org/onlinepubs/9699919799/ > > Though "whereis python3" shows the following on my system: > > python3: /usr/bin/python3.9-config /usr/bin/python3.9 /usr/bin/python3 > /usr/lib/python3.9 /usr/lib/python3 /etc/python3.9 /etc/python3 > /usr/local/lib/python3.9 /usr/include/python3.9 /usr/share/python3 > /usr/share/man/man1/python3.1.gz > > "which -a python3" returns: > > /usr/bin/python3 > /bin/python3 > > And "command -p -v" returns: > > /bin/python3 > > I don't know if we need all the results from "whereis"? > > -- > Rebecca Cran > I guess we could just use /bin/python3 (as in command -v python3) and readlink to find the actual version? In my local system "command -v python3" returns /usr/bin/python3 "readlink /usr/bin/python3" returns python3.10, which we could promptly parse into a version? I don't know how portable this is, but it's an idea. I definitely don't see the reason to iterate through every possible python3* in PATH. Pedro -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96571): https://edk2.groups.io/g/devel/message/96571 Mute This Topic: https://groups.io/mt/95182516/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-