[Top][All Lists]

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

Re: Incorrect alias expansion within command substitution

From: Robert Elz
Subject: Re: Incorrect alias expansion within command substitution
Date: Thu, 03 Feb 2022 10:18:42 +0700

    Date:        Wed, 02 Feb 2022 17:18:08 -0800
    From:        L A Walsh <bash@tlinx.org>
    Message-ID:  <61FB2D50.7010403@tlinx.org>

  | My posix non-conformance issue has to do with bash not starting with
  | aliases enabled by default in all default invocations.

If you're using aliases in scripts, then just stop doing that.
There's no need for it, it just makes your script harder to
follow.  Simply expand any aliases you"d use interactively,
and you will no longer care about this.

aliases can be uaeful interactively, so you need to type less
(though generally functions work better and are more flexible)
but there's no excuse for that in a script.

It's just the same with variable names - interactively I use
names like a b f ... - in a script I am much more likely to
use much more descriptive names (most good editors have a form
of macro expansion, where you get to just type a short word
and the editor expands that to a longer form - use that.)

Most people who use aliases in scripts are simply trying to
show how clever they are, and like almost everyone who
attempts that, the result is usually the exact opposite.

Just don't.


reply via email to

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