Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #239665

Re: which vs. type, and recursion?

From john doe <johndoe65534@mail.com>
Newsgroups linux.debian.user
Subject Re: which vs. type, and recursion?
Date 2021-09-04 11:30 +0200
Message-ID <CTA9P-1dG-13@gated-at.bofh.it> (permalink)
References <CTA9P-1dG-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 9/4/2021 11:21 AM, Richard Hector wrote:
> Greg Wooledge pointed out in another thread that 'type' is often better
> than 'which' for finding out what kind of command you're about to run,
> and where it comes from.
>
> A quick test, however, threw up another issue:
>
> richard@zircon:~$ type ls
> ls is aliased to `ls --color=auto'
>
> Great, so it's an alias. But what is the underlying ls? How do I find
> out? I did find out, by unaliasing ls and trying again, which showed
> that it's an actual executable, /usr/bin/ls, and not a shell builtin.
>
> But is there an easier/better way? Can 'type' be asked to recursively
> decode aliases?
>
> I looked at the relevant section of bash(1) (when I eventually found
> it), but was not particularly enlightened.
>

My understanding is that 'type' is to find the type while 'which' is to
find the executable path.

--
John Doe

Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

which vs. type, and recursion? Richard Hector <richard@walnut.gen.nz> - 2021-09-04 11:30 +0200
  Re: which vs. type, and recursion? john doe <johndoe65534@mail.com> - 2021-09-04 11:30 +0200

csiph-web