Timeline for How do commands resolve in bash?
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 24, 2022 at 13:41 | history | edited | Jeff Schaller♦ | CC BY-SA 4.0 |
deleted 2 characters in body
|
| Jan 24, 2022 at 13:00 | comment | added | Austin Hemmelgarn |
Indeed, bash, ZSH, and most of the other big FOSS shells internally alias type to command -V because that’s still POSIX compliant, but you arguably should not rely on that given that POSIX doesn’t require type to behave that way for shell keywords.
|
|
| Jan 23, 2022 at 18:42 | comment | added | ilkkachu |
@AustinHemmelgarn, yep, clarified. Not sure I can see a difference between type if and command -V if in any shell I have, though.
|
|
| Jan 23, 2022 at 18:40 | history | edited | ilkkachu | CC BY-SA 4.0 |
added 75 characters in body
|
| Jan 23, 2022 at 18:21 | comment | added | Austin Hemmelgarn |
As a side note, type -a is not reliably portable, only some shells implement it. type is portable provided the shell is POSIX compliant. And, if it’s available and you don’t need the full list of entries like type -a gives, you probably want to use command -V instead of either because it will properly identify unquoted literal shell keywords without requiring special quoting.
|
|
| Jan 23, 2022 at 10:46 | history | edited | ilkkachu | CC BY-SA 4.0 |
added 470 characters in body
|
| Jan 23, 2022 at 10:02 | vote | accept | Gulzar | ||
| Jan 23, 2022 at 9:50 | history | answered | ilkkachu | CC BY-SA 4.0 |