Tuesday, January 24, 2023

Unix Shell Programming Example for B.Sc, B.Tech, BCA, MCA

 2. Use of for loop.

PROGRAM:

echo "Enter number of elements:"
read n
for i in `seq 1 $n`
do
    echo $i
done

OUTPUT:

[bgc@localhost ~]$ sh pc.sh
Enter number of elements:
3
1
2
3
[bgc@localhost ~]$ 

No comments:

Post a Comment