Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: William Theisen Newsgroups: gnu.bash.bug Subject: Re: Code addition to BASH Date: Tue, 21 Jan 2020 16:13:36 -0500 Lines: 33 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1579641236 27973 209.51.188.17 (21 Jan 2020 21:13:56 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: chet.ramey@case.edu Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nd.edu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b5XrGnmOCnTHVqCrDaHoDUoc3w7/OtZvnT4Acyjrg/o=; b=ZM26Y9HpGlPBUHsxoBRvuWrOG2/b7IU0vBBNDDatw+bhxFIz0/d0TLezuxhBDfeNxg sjFxUCavKfJaQJTt2NWa+t9FjAvaaoVDHBV4qhk6pHEr9HYhPTMUNQAwb/WJSGFptZWt hBCoUIPcNgrhHvOealQUSt/Yc+ScwKdMsH0tszpZJQmfxM0TsNmd1kwmTtrZXEIdznvm P1VcIeE8L4m4V1fjG0p7waLfebL+4s7XxQq0X+LbgsJ6ogOMJv5ERdYpQmuRhXYeFtVG E8uqTCIoC/+pu4vaYw9OBCpK0+12QxuvOJb2OLcfN9R6Ga/UUlQPihwSZNBKXhOQ9Zbj JP5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b5XrGnmOCnTHVqCrDaHoDUoc3w7/OtZvnT4Acyjrg/o=; b=N9OX1FMXvUvGA/FrY5RJSWDddOVQuByXcmPgsoiBvK8Xj8yGJBfizKmlMYRXJIGoVQ gC7cfyWqbehbY2nhCxuUYGjofKeTgl91HKYxsKXGnSrLn+MD0lY4G/g1PxWUKmJnX4VV 2AT9CgeZ3npEhg18f63eYIV0cPpbXK1EUkh1RVsCwf4jKhbr5ROlrII7RFxrXb9d7/cI fUTPehsL21uPOzxxHsDSjGBprox2NEiwP+WYHFanP6fy1KFsTJv1pSg0AnbosSZ+ybV5 jVkIx3s+BuFFYT/Eap3kenVQwTpXpNQLSizBHo9NJ5jpVjLN+Nqm/iiiPsE+a5+8FkIL 1PDQ== X-Gm-Message-State: APjAAAX9cfQN5owl108+BG99x1EzvJIki/mgRMOZXO3HpSu5kE/y9Pwb 824mhT/P1GB+9iyb/RHx7r5koioMs4tfE1wiT33Cpg== X-Google-Smtp-Source: APXvYqy3PWpKbXh9EMhY97nZH0/rqa5D9rv4VmVL4SjpTfBdtRkHPQAM7gJLvbkOErxH8TYWhSdbDToojisGKsfhuhA= X-Received: by 2002:a67:f102:: with SMTP id n2mr587056vsk.138.1579641228216; Tue, 21 Jan 2020 13:13:48 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::e36 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:15821 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 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 chet@case.edu http://tiswww.cwru.edu/~chet/ >