Tuesday, 11 June 2013

shell script to accept a number from the user and display even number series till that number

Code:
no=0
echo "Enter limit"
read limit
echo "Even number series"
while [ $no -le $limit ]
do
    echo $no
    let no= $no + 2
done



Output:
[ty2011330@localhost ~]$ sh even.sh
Enter limit
10
Even number series
0
2
4
6
8
10

No comments:

Post a Comment