I've just tested this, it's a little awkward but does actually work. Thanks for the suggestion I'll play around with making it a little more convenient to use. Thanks for your time.
Regards, William Theisen On Tue, Jan 21, 2020 at 4:00 PM Chet Ramey <chet.ra...@case.edu> wrote: > 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 c...@case.edu http://tiswww.cwru.edu/~chet/ >