[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Portable equivalent of "type -p"?



jdassen@wi.leidenuniv.nl writes:
 > Is there a portable (POSIX) way of determining which binary will be called
 > for a particular command?

According to "Unix for the Impatient", 2nd Edition, by Abrahams and
Larson, p. 128:

    An alternative to "which" is the POSIX command `command -v' (see
    Section 5.10.1)

Section 5.10.1, p. 288:

        command -v
    
    This form is used to determine how the shell interprets a command
    name and can be used in place of the "type" command.
    
    [blah blah]

    -v  Produce the interpretation given to `cmd':

        o If `cmd' designates an executable file of any kind, produce
        the absolute pathname of that file.

        o If `cmd' is an intrinsic shell command, produce the string
        `cmd'.

        o If `cmd' is an alias (see Section 6.19), produce the
        definition of the alias.

HTH,

-- 
Jeff Sheinberg  <jeffsh@erols.com>


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: