home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pmafire!news.dell.com!swrinde!sdd.hp.com!think.com!ames!agate!doc.ic.ac.uk!uknet!warwick!warwick!not-for-mail
- From: maupb@csv.warwick.ac.uk (Mr J L Saunders)
- Newsgroups: comp.unix.questions
- Subject: Re: for loop backwards !!!!
- Message-ID: <1eo79mINN2vc@clover.csv.warwick.ac.uk>
- Date: 22 Nov 92 15:00:06 GMT
- References: <1en5jrINN1ui@cumin.csv.warwick.ac.uk>
- Organization: Computing Services, University of Warwick, UK
- Lines: 27
- NNTP-Posting-Host: clover.csv.warwick.ac.uk
-
- In article <1en5jrINN1ui@cumin.csv.warwick.ac.uk> cstaddc@csv.warwick.ac.uk (Mr M A Stuart) writes:
- %
- %
- % How can I do the equivilant of the following for loop under unix.
- %
- % for n := top to 1 do
- % commands etc etc
- %
- % Thanks for any suggestions !
-
- It depends on what shell you are using. In csh (or tcsh) you might do
-
- set top=20
- set n=top
-
- while ($n)
- commands
- set n = expr "$n -1"
- end
-
- Hope that helps...
-
- Jason
- --
- Jason L Saunders [ RouE ]
- email: maupb@csv.warwick.ac.uk
- snail: Warwick Business School, University of Warwick, Coventry CV4 7AL, UK
-