Sponsored Content
Full Discussion: for cycle
Top Forums Shell Programming and Scripting for cycle Post 302289059 by jim mcnamara on Wednesday 18th of February 2009 02:46:35 PM
Old 02-18-2009
Try it - it is correct

output with set -x
Code:
 t.sh
+ x=1
+ [[ 1 -lt 10 ]]
+ x=2
+ [[ 2 -lt 10 ]]
+ x=3
+ [[ 3 -lt 10 ]]
+ x=4
+ [[ 4 -lt 10 ]]
+ x=5
+ [[ 5 -lt 10 ]]
+ x=6
+ [[ 6 -lt 10 ]]
+ x=7
+ [[ 7 -lt 10 ]]
+ x=8
+ [[ 8 -lt 10 ]]
+ x=9
+ [[ 9 -lt 10 ]]
+ x=10
+ [[ 10 -lt 10 ]]

Code:
#!/bin/ksh

set -x
x=1
while [[ $x -lt 10 ]] 
do
     x=$(( $x + 1 ))
done

 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell cycle

Hello I got a cycle in the script which open another scripts. if then action fi Scripts action will be running 2 times at the same time. Inside of action() is insert into the table. But what I want is that only first script can do insert into table. So how to do... (2 Replies)
Discussion started by: mape
2 Replies

2. Shell Programming and Scripting

For cycle

Hello, I have files in a dir. I what to create a FOR cycle that will do this FOR <condition> do file=`ls <directory> | tail -1` echo $file mv -f $file <another dir> done What I want to now is what should I put in the <condition>. The condition I want is that the FOR will execute... (3 Replies)
Discussion started by: nagomes
3 Replies

3. Shell Programming and Scripting

wildcard in a if cycle

hello everybody, I need help on putting a wildcard match inside an if condition (I'm using korn shell): if ] then echo ' ' echo ''$MYSEL' is not a correct option' echo ' ' else ..... i tried also #if -ne "``" and a lot of combinations of `"' but I didn't find the... (2 Replies)
Discussion started by: elionba82
2 Replies

4. Shell Programming and Scripting

for cycle question

i have a question how to modify below script to generate the expect result below : test.sh #!/bin/bash for ((i=0; i < 25; i++)) do echo $1$i done current result: test.sh 20090101 200901010 200901011 200901012 200901013 200901014 200901015 200901016 200901017 200901018 (2 Replies)
Discussion started by: bleach8578
2 Replies

5. Shell Programming and Scripting

sed problem in a for cycle

Hi, i have a problem with a sed command runned in a for cycle... I have a file named fileX which contains (i have crippled the line to minimal for easy): load data dbfoo - TOCHANGE - comment load data dbboo - TOCHANGE - comment load data dbzoo - TOCHANGE - comment ... And a file... (8 Replies)
Discussion started by: maxlamax
8 Replies

6. Shell Programming and Scripting

Cycle for with for-then-else

Hi, i would like to insert a if-then-else function in to cycle for -------------- cat test -------------- # cat test ALFA BETA GAMMA ----------------------- This is my script: #!/bin/bash for i in $(cat test); if ; then echo "ok" else (5 Replies)
Discussion started by: elilmal
5 Replies

7. UNIX for Beginners Questions & Answers

For cycle, process order

Hello, I am running a script under ubuntu 16.04 I have no problem with the script. My question is general algorithm of for file command. I just need to know how for file in *.txt process works. Let's say, I wish to run the script by sorting filename: for file in *.txt do "do something in... (2 Replies)
Discussion started by: baris35
2 Replies
cycle(1)                                                               Utils                                                              cycle(1)

NAME
cycle - a calendar for women SYNOPSIS
cycle DESCRIPTION
Cycle is a calendar program for women. Given a cycle length or statistics for several periods, it can calculate the days until menstrua- tion, the days of "safe" sex, the fertile period, and the days to ovulations, and define the d.o.b. (date of birth) of a child. It allows the user to write notes and helps to supervise the reception of hormonal contraceptive tablets. FEATURES
The program is capable of: - Calculate of the days of menstruation, based on length of the cycle or on statistics of a period. - Calculate the "safe" sex days, fertile period and day to ovulations - Definition of D.O.B . (Date Of Birth) of a child - Allows to write notes - Helps to supervise reception of hormonal contraceptive tablets HOW DOES IT WORK
It uses the calendar method for the definition of fertile days. For this is necessary to determine duration, at least, of last six cycles. For determine the fertile days it uses this algoritm: - First day: duration of shortest cycle minus 18 - Last day: duration of longest cycle minus 11 - Ovulation: is considered in the middle of fertile period (Determine the exact day isn't possible with the calendar method) Date of a birth of the child is counted from the beginning of last menstruation (in obstetrics are accepted 40 weeks). This date is cor- rected with the duration of a cycle (are subtracted or added same number of days that a cycle differs from 28 days). Is possible check the results at: http://cir.msk.ru/sroki.shtml (in Russian) USAGE
It is necessary to mark the beginning of menstruation. This is possible clicking with the right button on the date and chosing "The begin- ning of a cycle". Similarly the mark can be removed. Using duration of last six cycles, the program will calculate - Fertile period - green cells - Ovulation day (the middle fertile period) - brightly green cell - Beginning of following menstruation - pink cells Cycle duration is set in options or is calculated an average of last six periods. To determine prospective date of a birth of the child, it is necessary first day of last cycle to mark in addition as "Pregnancy". Depending on your purposes, you can display only "Safe" sex days or only fertile days. Information about interesting day can be received clicking with left button. Is possible adding a note to any date using corresponding item of the menu. Day with a note are underlined. It is necessary to note that factor of failures of calendar contraception method is about 10 percent. This method is suitable only for women with enough regular cycle. If your doctor has recommended hormonal contraceptive this program will help to supervise their reception. Closely familiarize with the instruction applied to the chosen preparation. Packing can contain 21 tablet (the circuit of reception 21 day on one tablet, then 7 days pause) or 28 tablets in this case all tablets are accepted without interruption every day of 28. In the program, is marked only day of reception of each first tablet of packing. NOTE: This program is not a reliable contraceptive method. It does neither help to prevent sexual transmision diseases like AIDS. It is just an electronic means of keeping track of some of your medical data and extract some statistical conclusions from them. You cannot con- sider this program as a substitute for your gynecologist in any way. FILES
~/.cycle This is the directory where cycle stores the data. AUTHOR
cycle was written by Oleg S. Gints. This manual page was written for Debian by Miriam Ruiz <little_miry@yahoo.es>. SEE ALSO
You can find cycle's home page at: http://cycle.sourceforge.net/ More information about calendar method are available at: http://www.mama.ru/gynecolog/STA/st18.htm (in Russian) Miriam Ruiz 6 April 2005 cycle(1)
All times are GMT -4. The time now is 04:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy