[PLUG] Re: strange ln -s behavior

Rogan Creswick creswick at gmail.com
Fri Jun 29 06:36:29 UTC 2007


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 "unalias" it just
> Rogan> 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'


--Rogan



More information about the PLUG mailing list