bug-bash
[Top][All Lists]
Advanced

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

Re: Code addition to BASH


From: Chet Ramey
Subject: Re: Code addition to BASH
Date: Tue, 21 Jan 2020 16:00:43 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 1/21/20 2:01 PM, William Theisen wrote:
> Running BASH version 5.0 on ubuntu 18.04
> 
> Hi I've recently made a code change to my local version of bash that I find
> quite useful as a QOL update for scripters. I've added an environmental
> variable called ITERMAX that allows me to see the size of the iterable
> being used in the for loop. This means I can display progress bars and the
> like similar to TQDM in python. Is this something that I could make a PR
> for or is adding new shell variables considered taboo and to be avoided.

Is this something that could be done using the positional parameters? You
could generate the list you would pass to `for' using set -- (or
equivalent), use `for i', since that is equivalent to `for i in "$@"', and
you would then have $# available as the number of iterations.

Chet

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



reply via email to

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