5. Write a shell script which will accept a number and display first n prime numbers as output. Complete code of the program read -p "Enter the value of n (or range) " n echo "The prime numbers are: " m=2 while [ $m -le $n ] do i=2 flag=0 while [ $i -le `expr $m / 2` ] do if [ `expr $m % $i` -eq 0 ] then flag=1 break fi i=`expr $i + 1` done if [ $flag -eq 0 ] then echo $m fi m=`expr $m + 1` done Interpreting the prime.sh file and executing it in terminal tkanu025@hp:~/lab_solutions$ chmod +x prime.sh tkanu025@hp:~/lab_solutions$ ./prime.sh Output Previous Program Next Program gtu os lab manual, os GTU Practical, operating system Programs, Operating system shellscript programs, Gtu study material 3140705, OS 314070...
Comments
very bad to tell.