Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure.ac: use "command -v" instead of "type -p" #129

Merged
merged 1 commit into from
Jan 5, 2018

Conversation

bjornfor
Copy link
Contributor

@bjornfor bjornfor commented Aug 1, 2017

"type -p" is a Bash thing, whereas "command -v" is specified by POSIX
(more portable).

"type -p" is a Bash thing, whereas "command -v" is specified by POSIX
(more portable).
@domenkozar
Copy link
Member

Can you point to docs claiming that? :)

@bjornfor
Copy link
Contributor Author

bjornfor commented Aug 5, 2017

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html

The first link shows that "command -v" is in POSIX and the latter that "type" (in POSIX) doesn't support any flags. "command -v" works in e.g. dash and bash, whereas "type -p" only works in bash.

@bjornfor
Copy link
Contributor Author

bjornfor commented Aug 5, 2017

Some practical examples:

$ bash -c "type -p getconf"
/run/current-system/sw/bin/getconf
$ bash -c "command -v getconf"
/run/current-system/sw/bin/getconf
$ dash -c "type -p getconf"
-p: not found
getconf is /run/current-system/sw/bin/getconf
### the above command exited with status 127
$ dash -c "command -v getconf"
/run/current-system/sw/bin/getconf

@domenkozar domenkozar merged commit 840eb0e into NixOS:master Jan 5, 2018
@bjornfor bjornfor deleted the posix branch January 5, 2018 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants