bug-bash
[Top][All Lists]
Advanced

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

Re: feature-request: brief syntax for $(type -p somecommand)


From: Mike Coleman
Subject: Re: feature-request: brief syntax for $(type -p somecommand)
Date: Thu, 2 Apr 2009 11:42:46 -0500

On Thu, Apr 2, 2009 at 11:33 AM, Chris F.A. Johnson <cfaj@freeshell.org> wrote:
> On Thu, 2 Apr 2009, Mike Coleman wrote:
>
>> [Oops--I sent that incomplete.]
>>
>> It would be nice if there was some really brief syntax for
>>
>>   $(type -p somecommand)
>>
>> I find myself using this all day long with 'ls', 'file', 'ldd',
>> 'strings', 'nm', etc., and the current incantation is just long enough
>> to be annoying.
>
>   Use a function, e.g.:
>
> p()
> {
>  pp=$( type -p "$@" )
> }


Hmm.  So I would use this like so?

    $ p somecommand; ls -l $pp

I guess it's not obvious that that's an improvement.  Along these
lines, though, is there some way to do something like this

    script named 'p':
    $!/bin/bash
    exec type -p "$1"

which could then be used like

    $ ls -l $(p somecommand)

except without the external script?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]