Portál AbcLinuxu, 1. května 2025 14:14
$ equery b which * Searching for which ... sys-apps/which-2.21 (/usr/bin/which) $ eix sys-apps/which [I] sys-apps/which Available versions: 2.21 Installed versions: 2.21(18:13:34 23.8.2017) Homepage: https://carlowood.github.io/which/ Description: Prints out location of specified executables that are in your pathA na onom odkazu se píše ...
$ cat which.lsm Begin3 Title: which Version: Entered-date: 09APR99 Description: Which is a utility that prints out the full path of the executables that bash(1) would execute when the passed program names would have been entered on the shell prompt. It does this by using the exact same algorithm as bash. Tildes and a dot in the PATH are now expanded to the full path by default. Options allow to rather print "~/*" or "./*" and/or to print all exectuables that match any directory in PATH. Keywords: which utility directory path executable bash Author: carlo at gnu.org (Carlo Wood) Maintained-by: carlo at alinoe.com (Carlo Wood) Primary-site: http://www.xs4all.nl/~carlo17/which/ Original-site: Alternate-site: ftp.gnu.org /gnu/which Platforms: linux netbsd freebsd bsdi osf1, probably all UNIX. Copying-policy: GPL End
$ rpm -qi which Name : which Version : 2.21 Release : 2.fc26 Architecture: x86_64 Install Date: Mon 17 Jul 2017 10:47:07 AM CEST Group : Applications/System Size : 77261 License : GPLv3 Signature : RSA/SHA256, Mon 13 Feb 2017 12:39:48 PM CET, Key ID 812a6b4b64dab85d Source RPM : which-2.21-2.fc26.src.rpm Build Date : Sun 12 Feb 2017 05:05:13 AM CET Build Host : buildhw-10.phx2.fedoraproject.org Relocations : (not relocatable) Packager : Fedora Project Vendor : Fedora Project URL : https://savannah.gnu.org/projects/which/ Summary : Displays where a particular program in your path is located Description : The which command shows the full pathname of a specified program, if the specified program is in your PATH.V README souboru je pak krátká zmínka o historii:
History ======= The main difference with version 1.0 by Paul Vixie is that this version will not return directory names as being executables and that by default it will expand a leading "./" and "~/" to its full path on output. The -all option has been added in example of a version of which on Ultrix. They use `-a' as option. The --read-alias idea has been copied from a version of which by Maarten Litmaath called `which-v6', he was using `-i' as option which stands for `interactive'.Wikipedia pak pro which (Unix) žádný standard neuvádí. Ale vtipné je, že na té wikipedii píšou, že existuje posixový standard pro příkaz command, který pracuje podobně:
$ command -v dnf /usr/bin/dnfV textu toho standardu pak píšou:
The command -v and -V options were added to satisfy requirements from users that are currently accomplished by three different historical utilities: type in the System V shell, whence in the KornShell, and which in the C shell. Since there is no historical agreement on how and what to accomplish here, the POSIX command utility was enhanced and the historical utilities were left unmodified. The C shell which merely conducts a path search. The KornShell whence is more elaborate-in addition to the categories required by POSIX, it also reports on tracked aliases, exported aliases, and undefined functions.Takže je to takonec tak, že `which` není v žádném standardu protože na tom nebyla shoda, a standardizovaný je místo toho ten `command`.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.