if test $flag –eq 1then echo “The number is Not Prime”else echo “The number is Prime”
fi
Linux Shell script to display prime numbers
echo 'Enter no'
read x
n=2
while [ $n -le $x ]
do
i=2
count=1
while [ $i -lt $n ]
do
if [ `expr $n % $i` -eq 0 ]
then
count=0
break
fi
i=`expr $i + 1`
done
if [ $count -eq 1 ]
then
echo "$n is Prime"
fi
n=`expr $n + 1`
done
Linux shell script to display date, time of the machine:
now=$(date) echo “$now” echo “Current date: $now” echo Current Date and Time is: `date +”%Y-%m-%d %T”`
Linux shell script/commands to find os name and version:
cat /etc/os-release
Linux shell script/commands to list processes running: