[PLUG] Re: strange ln -s behavior

Paul Heinlein heinlein at madboa.com
Fri Jun 29 14:06:42 UTC 2007


On Thu, 28 Jun 2007, Rogan Creswick wrote:

> On 6/21/07, Randal L. Schwartz <merlyn at stonehenge.com> wrote:
>> > > > > >  "Rogan" == Rogan Creswick <creswick at gmail.com> writes:
>> 
>> Rogan>  In bash you can also prepend a command with a "\" to 
>> Rogan>  "unalias" it just once.  eg:
>> 
>> Rogan>  $ \ls --color=always
>> 
>
> In the same vein, here's a function I just cooked up, and really, 
> really, want to call 'which', but Randal's points are well made. 
> (Although, I think the cat has been out of the bag for quite some 
> time now.)
>
> Anyhow, the function not to be know as 'which':
>
> #  "semi" intelligent version of 'which'.  it just checks aliases 
> #  before checking the filesystem:
> function wh { alias $1 2>/dev/null || which $1; }
>
> I don't know of a way to do this with an alias, and it's hardly been 
> tested.  As far as I can tell, it works:
>
> | rogue on escher |charged| @ 23:29:55 ~|
> wh bash
> /bin/bash
> | rogue on escher |charged| @ 23:29:56 ~|
> wh ll
> alias ll='ls -lh --color=tty'

Ummm, isn't that what the "type" builtin is for?

   [heinlein]$ type type
   type is a shell builtin
   [heinlein]$ type env
   env is /usr/bin/env
   [heinlein]$ type ls
   ls is aliased to `/bin/ls -F'

-- 
Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/



More information about the PLUG mailing list