The following is the data in my file and i want to load it using bash script
eth0/0,up,up,text
eth0/1,up,up,text2
eth0/2,down,down,text3
i want to load these in array and compare each lines
if [ ${myArray[2]} == "up" ]; then
echo ${myArray[3}
elif ${myArray[2]} == "down"; then
echo ${myArray[3]}
else
echo "error"
fi
I want to compare the arrays and provide the last array as the output
Output
eth0/0 up text