bug-bash
[Top][All Lists]
Advanced

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

Re: Incorrect alias expansion within command substitution


From: Chet Ramey
Subject: Re: Incorrect alias expansion within command substitution
Date: Thu, 3 Feb 2022 14:18:18 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1

On 2/3/22 12:05 PM, L A Walsh wrote:

    There's no need for it, it just makes your script harder to
    follow.
---
    I write scripts for myself.  aliases make scriptes easier to create
modify and maintain.  You can type 'declare -i x=1', I prefer 'int x=1' I find 'declare -xxyz' harder to write, read and parse than 'my', 'array' 'map'

This is, as you say, a personal preference for private scripts. You're free
to advocate for that style, but don't expect other people to see its
advantages.

We aren't talking 100 aliases, but these:
alias my='declare ' int='my -i ' array='my -a ' map='my -A '

are used in nearly all my scripts.

OK. Does the number of aliases really matter?

There is no way you can tell me that:
declare var='v'
declare -i ivar=1

are more clear than:

my var='v'
int ivar=1

This is, again, a personal preference. The former has the advantage of
being documented.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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