forked from tushargoyal02/bashScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhileLoop.sh
More file actions
44 lines (26 loc) · 714 Bytes
/
whileLoop.sh
File metadata and controls
44 lines (26 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
count=1
# FOLLOW THIS SYNTAX
while [ $count -lt 10 ] ; do
echo "count value inside loop is $count"
# let keyword is used to allow increase in value
let count=count+1
echo "increasing count value : $count"
done
# -------------------------------------------------------------
# BREAK STATEMENT
## Second while statement
var=20
while [ $var -lt 27 ] ; do
let var=var+1
echo "var"
#check with if condition & break
if [ $var -eq 25 ] ;
then
#printing values as per the condition check
((output=var/5))
echo "output value as per if conditon: $output"
break
fi
echo $var
done