[Top][All Lists]

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

Re: alias problem -- conflict found

From: Dennis Williamson
Subject: Re: alias problem -- conflict found
Date: Fri, 12 Jul 2019 16:43:48 -0500

On Fri, Jul 12, 2019, 3:46 PM L A Walsh <address@hidden> wrote:

> On 2019/07/12 11:51, Eli Schwartz wrote:
> find_cmds() {
>   for c in "$@"; do
>     type -P $c >&/dev/null || {
>       Pe "$0#$LINENO: Cannot find %s", "$c"
>       exit 1; }
>     alias $c=$(type -P $c);
>   done
> }

This is a perfect example. I have to guess what Pe is. I presume it means
Print_error. If so, that's what it should be named - for readability. And
instead of assuming that it's a function, I have to hope it's not an alias.
By the way, why isn't type -p aliases to Pathof or something?


>     You claim that my saying the bash-builtins are a type of alias for an
> external command that it is intended to have some similar functionality
> to, is
> "nonsense".  To  that assertion, I used the fact that many or most bash
> builtins that replace external counterparts are also following some
> POSIX stated behavior to support my original assertion that they are
> intended to be drop-in
> replacements for those commands.  I.e. using the design requirements for
> those bash built-ins that replace external posix components, its easy to
> see
> that your nonsensical response of 'Nonsense' was incorrect.  Talking about
> different methods of saying the same thing, like aliasing is about as on
> topic as anything.

Baby Face Nelson is an alias for Lester Joseph Gillis. John Dillinger was a
contemporaneous bank robber but he was not an alias for Mr. Gillis (but
they did partner at one point). Perhaps Pretty Boy Floyd would make a
better example though since his nickname bears a similarity to Gillis'.

But I digress.


Ultimately one of the facts at issue is that Bash is both a scripting
language and a command line interface. As the latter, it includes a number
of command line conveniences that should not be used in scripts. Among
those, in my opinion, are aliases and tilde expansions. I would also
include the overuse of pipes. Of course they are fundamental to the Unix
way and hacking something together on a command line for a one off or while
feeling one's way toward a solution is fine. I'd better not see a script
containing grep piped into awk

As far as saving keystrokes while typing goes, any good editor can be a
great deal of help in this pursuit.

reply via email to

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