Write a shell script to check whether a number is a Prime number or not.

 


 Write a shell script to check whether a number             is a Prime number or not.




Program =



#!/bin/bash

echo "Utsav Gohel - 91900104011"

echo "Enter number"

read number

prime=1

for (( i = 2;  $i < $number;  i++ ))

do

if [[ `expr $number % $i `  -eq 0 ]]

then

prime=0

fi

done

if [[ $prime -eq 1 ]]

then

echo "Prime"

else

echo "Not Prime"

fi

 



Output =