|
|
Log in / Subscribe / Register

Debian's which hunt

Debian's which hunt

Posted Oct 28, 2021 17:48 UTC (Thu) by oever (guest, #987)
In reply to: Debian's which hunt by dskoll
Parent article: Debian's which hunt

"type -Pp $command" gives the path to the file that would be executed and nothing for aliases.

That seems at least as good as "command -v $command".


to post comments

Debian's which hunt

Posted Oct 28, 2021 18:18 UTC (Thu) by smcv (subscriber, #53363) [Link]

> "type -Pp $command" gives the path to the file that would be executed and nothing for aliases.

In bash, yes. In other shells or on non-Linux OSs, no, so this is less portable than `command -v` (and in particular dash doesn't implement the -P or -p options).

POSIX specifies the `type` command, but does not specify any valid options for it.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds