News for hackers. Stuff that matters.
Re:Which is not Posix by tptacek on Monday November 01, 2021 @12:33PM (#29069085)
Yeah, no thanks, I'm going to keep using `which`, and distributions are going to support it, no matter how "standard" `command -v` is. The only reason we're talking about this is that it's so noteworthy that any distro would seriously suggest people avoid `which`, which is the de facto standard.
Re:Which is not Posix by chasil on Monday November 01, 2021 @12:41PM (#29069223)
Busybox also supports both variants, which is nice.

    C:\Users\luser>busybox64 sh
    ~ $ command -v ssh
    C:/WINDOWS/System32/OpenSSH/ssh.exe
    ~ $ which ssh
    C:/WINDOWS/System32/OpenSSH/ssh.exe
    ~ $ exit
Re:Which is not Posix by GauntletWizard on Monday November 01, 2021 @12:58PM (#29069494)
Busybox supports may subcommands, and on systems based on it virtually every common command is aliased to it, but nice isn't included.

    which which 
    /bin/which
    which nice
    
So, no, `which` is not `nice` :).

Edit: I just pulled the the latest dockerhub image, and nice is one of the included applets. So if you really want which to be nice, upgrade busybox.

Re:Which is not Posix by oweiler on Monday November 01, 2021 @02:11PM (#29070577)
There are enough dists which don't support which.
Re:Which is not Posix by coldtea on Monday November 01, 2021 @02:24PM (#29070783)
Any that more than 10 people use?
Re:Which is not Posix by Seirdy on Monday November 01, 2021 @03:50PM (#29072064)
The Fedora base image does not include which. The base image is what's used in the standard OCI Fedora container, some Flatpak work, and some other things.

Arch also doesn't include "which", nor do some arch-based distros.

Re:Which is not Posix by maxnoe on Monday November 01, 2021 @03:54PM (#29072127)
Arch uses zsh in the Installation Medium and bash as default shell of the code System, both have which as a builtin function.
Re:Which is not Posix by Seirdy on Monday November 01, 2021 @04:28PM (#29072611)
I wasn't referring to the installation medium, but the base image typically used for setting up servers/chroots/containers.
Re:Which is not Posix by orhmeh09 on Monday November 01, 2021 @04:20PM (#29072501)
FWIW, Debian uses dash as its default shell. It does not appear to have which as a builtin.
Re:Which is not Posix by pxc on Monday November 01, 2021 @04:09PM (#29072345)
Except the behavior of the builtin is not the same as the behavior of the program, and Arch's base package doesn't include the which command.
Re:Which is not Posix by maxnoe on Monday November 01, 2021 @04:36PM (#29072702)
Re:Which is not Posix by pxc on Monday November 01, 2021 @04:46PM (#29072885)
Thanks for pointing that out! I'll add it to my pacstrap invocations in the future.
Re:Which is not Posix by jfrunyon on Monday November 01, 2021 @05:37PM (#29073483)
... huh? which is not a bash builtin.