Skip to content
Snippets Groups Projects

`command -v` portability

Merged Eli Schwartz requested to merge eschwartz/xdg-utils:command-v-portability into master
5 unresolved threads
Compare changes
  • Side-by-side
  • Inline
Files
11
  • The "which" utility is not guaranteed to be installed, and if it
    is, its behavior is not portable.
    
    Conversely, the "command -v" shell builtin is required to exist in all
    POSIX 2008 compliant shells, and is thus guaranteed to work everywhere.
    
    Examples of open-source shells likely to be installed as /bin/sh on
    Linux, which implement the 12-year-old standard: ash, bash, busybox,
    dash, ksh, mksh and zsh.
    
    A side benefit of using the POSIX portable option is that it does not
    require an external disk executable to be forked. This therefore
    represents a mild speedup.
Loading