From owner-freebsd-questions Tue Mar 14 13:31:20 2000 Delivered-To: freebsd-questions@freebsd.org Received: from enterweb.enterit.com (enterweb.enterit.com [209.45.199.22]) by hub.freebsd.org (Postfix) with ESMTP id 73C0937B6B6 for ; Tue, 14 Mar 2000 13:31:16 -0800 (PST) (envelope-from jconner@enterit.com) Received: from KWAN [209.45.199.38] by enterweb.enterit.com with ESMTP (SMTPD32-5.04) id AF6F9800FE; Tue, 14 Mar 2000 16:30:23 DT Message-Id: <4.2.0.58.20000314163021.00aa4110@mail.enterit.com> X-Sender: notjames@mail.pseudonet.org X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 Date: Tue, 14 Mar 2000 16:39:07 -0500 To: Dan Nelson , keith@mail.telestream.com From: Jim C Subject: Re: silly off topic scripting question Cc: freebsd-questions@FreeBSD.ORG In-Reply-To: <20000314144600.A97517@dan.emsphone.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 14.46 14.03.00 -0600, Dan Nelson wrote: >In the last episode (Mar 14), keith@mail.telestream.com said: > > How can one append a variable in BASH? Like run a loop and have the > > results of the loop append a variable instead of just resetting the > > variable with the new result? > > I have the bash book and don't seem to see this discussed anywhere. > >$ newdata=hello >$ var=test >$ var=$var$newdata >$ echo $var > >testhello >$ Yup...so: for loop in 1 2 3 4 do newVar=$((loop + 1)) loop="$loop$newVar" echo $loop done >-- > Dan Nelson > dnelson@emsphone.com > > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message