You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way the binary gets discovered is unnecessarily complicated. Instead of starting an external binary (a whole new process), I recommend that the script simply checks the $PATH env variable. The syntax for it is very simple.
`root@ubuntu-s-2vcpu-4gb-amd-sfo3-01:~# which which
/usr/bin/which`
I always laugh when I do that because it reminds me of the Wizard of Oz.
"Wicked Witch of the East - Wikipedia
The Wicked Witch of the East
The Wicked Witch of the East was featured in the film The Wizard of Oz (1939), in which she is the sister of the Wicked Witch of the West. As in the book, she is killed when Dorothy's house falls on her."
Activity
stefan6419846 commentedon Mar 25, 2024
It is even easier with recent Python versions by relying on the stdlib
shutil.which.sscotti commentedon Mar 26, 2024
Is that the same as ?
`root@ubuntu-s-2vcpu-4gb-amd-sfo3-01:~# which which
/usr/bin/which`
I always laugh when I do that because it reminds me of the Wizard of Oz.
"Wicked Witch of the East - Wikipedia
The Wicked Witch of the East
The Wicked Witch of the East was featured in the film The Wizard of Oz (1939), in which she is the sister of the Wicked Witch of the West. As in the book, she is killed when Dorothy's house falls on her."
stefan6419846 commentedon Mar 26, 2024
It should be mostly identical to the known
whichtool, but implemented in pure Python: https://github.com/python/cpython/blob/1c72265a31eaf8724a5dd16391b951366460b64e/Lib/shutil.py#L1525-L1605