3 ms·
Why make this bash specific by using command -v? How is that better than "which" which works on any shell I can think of? Running FreeBSD, one of my pet peeve
by drewg123 5y ago
Why make this bash specific by using command -v? How is that better than "which" which works on any shell I can think of?
Running FreeBSD, one of my pet peeves is folks who assume /bin/bash is going to exist everywhere.
- tyingq 5y agoLooks like FreeBSD added "command -v" to /bin/sh some time ago. Though, yes, putting bash in the interpreter line doesn't help that. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=77259 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=77259
- SuchAnonMuchWow 5y agoI always though that "command -v" was more portable than "which": "command -v" is specified in posix and should always be present but "which" is not. But all my knowledge about that comes from a small drama some times ago when a debian maintainer wanted to remove "which" from its current package (see https://lwn.net/SubscriberLink/874049/bf89a969ed3dde87/ https://lwn.net/SubscriberLink/874049/bf89a969ed3dde87/).
- macintux 5y agoDiscussed extensively here recently: https://news.ycombinator.com/item?id=29026623 https://news.ycombinator.com/item?id=29026623