Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #239663 > unrolled thread
| Started by | Brian <ad44@cityscape.co.uk> |
|---|---|
| First post | 2021-09-04 11:30 +0200 |
| Last post | 2021-09-04 12:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.debian.user
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: which vs. type, and recursion? Brian <ad44@cityscape.co.uk> - 2021-09-04 11:30 +0200
Re: which vs. type, and recursion? Richard Hector <richard@walnut.gen.nz> - 2021-09-04 12:00 +0200
| From | Brian <ad44@cityscape.co.uk> |
|---|---|
| Date | 2021-09-04 11:30 +0200 |
| Subject | Re: which vs. type, and recursion? |
| Message-ID | <CTA9P-1dG-9@gated-at.bofh.it> |
On Sat 04 Sep 2021 at 21:21:38 +1200, 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. Use 'help type' and try 'type -a ls'. -- Brian.
[toc] | [next] | [standalone]
| From | Richard Hector <richard@walnut.gen.nz> |
|---|---|
| Date | 2021-09-04 12:00 +0200 |
| Message-ID | <CTACR-1p8-3@gated-at.bofh.it> |
| In reply to | #239663 |
On 4/09/21 9:26 pm, Brian wrote:
> On Sat 04 Sep 2021 at 21:21:38 +1200, 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.
>
> Use 'help type' and try 'type -a ls'.
>
That ('help type') is much more readable than bash(1), thanks. I think I
might have known about 'help', but had forgotten ...
Cheers,
Richard
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web