On Sat, Jan 20, 2018 at 5:19 AM, Jon Ingason <jon.ingason(a)telia.com> wrote:
Den 2018-01-20 kl. 10:34, skrev Tom H:
> On Sat, Jan 20, 2018 at 2:10 AM, Cameron Simpson <cs(a)cskk.id.au> wrote:
>>
>> Also: "which rm" should show what executable is being used, and the
>> bash "which" IIRC also shows if an alias or function is involved
(I'm
>> a zsh person myself).
>
> There's no "which" builtin in bash. IIRC, only tcsh and zsh have one.
>
> On Debuntu, "which" is an sh script (as it was a csh script in the
> past in Unix):
>
> th@sid ~ $ file /bin/which
> /bin/which: POSIX shell script, ASCII text executable
> th@sid ~ $
>
> It only shows a command with an absolute path and it only has a "-a"
option:
>
> th@sid ~ $ which -a which
> /usr/bin/which
> /bin/which
> th@sid ~ $
>
> In bash, "command -v", "command -V", "type -t" will
show what an executable is.
I get following results:
$ cat /etc/fedora-release
Fedora release 26 (Twenty Six)
$ uname -srvmo
Linux 4.14.13-200.fc26.x86_64 #1 SMP Thu Jan 11 05:43:34 UTC 2018 x86_64
GNU/Linux
$ $ which -a which
alias which='(alias; declare -f) | /usr/bin/which --tty-only
--read-alias --read-functions --show-tilde --show-dot'
/usr/bin/which
$ file /usr/bin/which
/usr/bin/which: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for
GNU/Linux 2.6.32,
BuildID[sha1]=e5043d949b50c50148e2d8e3db71b9ee7bf8b9e9, stripped
I read out of this that there is only on which, /usr/bin/which, at least
in Fedora 26 :-)
On Fedora, of course! "which" on Fedora is a compiled executable whose
upstream is on
gnu.org.
I was responding to the suggestion of using "which" on Ubuntu.