From owner-freebsd-questions Tue Jul 9 11:31:37 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B2FE637B400 for ; Tue, 9 Jul 2002 11:31:34 -0700 (PDT) Received: from clunix.cl.msu.edu (clunix.cl.msu.edu [35.9.2.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1984B43E09 for ; Tue, 9 Jul 2002 11:31:34 -0700 (PDT) (envelope-from jerrymc@clunix.cl.msu.edu) Received: (from jerrymc@localhost) by clunix.cl.msu.edu (8.11.6+Sun/8.11.6) id g69IVPp19888; Tue, 9 Jul 2002 14:31:25 -0400 (EDT) From: Jerry McAllister Message-Id: <200207091831.g69IVPp19888@clunix.cl.msu.edu> Subject: Re: How do I repeat a command N times? To: effdefender@earthlink.net Date: Tue, 9 Jul 2002 14:31:25 -0400 (EDT) Cc: david@customfilmeffects.com (David Smithson), freebsd-questions@FreeBSD.ORG (FreeBSD-Questions) In-Reply-To: <001001c2276c$bacddcc0$0301a8c0@sys.gtei.net> from "James" at Jul 09, 2002 10:19:06 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > I'm still new, but: > It's probably your shell. > The C-Shell (csh) isn't good for programming scripts. > Try changing to the Bourne shell (sh) and running it again. > Switch to the Bourne shell simply by typing "sh" I don't understand that comment. Most people I know switch FROM Bourne to have easier script programming. sh is used only because it is so omni-present, even more than csh or tcsh or bash. Of course, the syntax is different between sh and csh so you can't just plop csh script in and interpret it as sh and vice versa. > I think you might be able to program the C-Shell with C like statements, but > I'm still learning. Good. Keep learning. See below for useful version csh syntax. Actually, usually I just use Perl. It is so easy. But, I hear it may not be available by default from now on. ////jerry > > Hope this helps! > -James Turnbull > ----- Original Message ----- > From: "David Smithson" > To: "FreeBSD-Questions" > Sent: Tuesday, July 09, 2002 10:13 AM > Subject: Re: How do I repeat a command N times? > > > > Wow! So many options. > > > > Perl returns: "Badly placed ( " > > > > My shell is csh > > > > CSH returns "let: arith: syntax error: 'x=+1'" , yet continues and works. > > What's with the error? Well, I am guessing that here you want something like #!/bin/csh # Note that 0 -> 606 is exactly 607 times unlike some of the # other examples given (or use 1 -> 607 to be clear). @ fst = 0 @ max = 606 while ($fst <= $max) echo Count is $fst # Do whatever you need done here @ fst = $fst + 1 # alternatively you could increment as follows (minus the initial pound sign) # @ fst++ end To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message