SCRIPT TO FIND THE SEQ SEARCH ON ARRAY
#!/bash/sh
echo "enter the array size"
read n
found=0
echo "enter the element"
for ((i=0;i<$n;i++))
do
read t
num[$i]=$t
done
echo "enter the key"
read k
for ((i=0;i<$n;i++))
do
if [ $[ num[$i] ] -eq $k ]
then
found=1
fi
done
if [ $found -eq 1 ]
then
echo "key found"
else
echo "not found"
fi
#!/bash/sh
echo "enter the array size"
read n
found=0
echo "enter the element"
for ((i=0;i<$n;i++))
do
read t
num[$i]=$t
done
echo "enter the key"
read k
for ((i=0;i<$n;i++))
do
if [ $[ num[$i] ] -eq $k ]
then
found=1
fi
done
if [ $found -eq 1 ]
then
echo "key found"
else
echo "not found"
fi