shell script to enter 5 records in array. Ask the user to search value from the array.
clear
read -p "Enter Array Size :" size
for((i=0;i<size;i++))
do
read arr[$i]
done
read -p "Enter Number for Search :" no
echo "Array :" ${arr[*]}
for((i=0;i<size;i++))
do
if(($no==${arr[$i]}));then
echo "$no is Found in the Array"
break
fi
done
Search in Array Shell Script
Reviewed by Unknown
on
6:32 pm
Rating:
No comments: