I need to return a true or false if I find a value within a file. I parse the file and if the value is located once which is enough, I want to break and return a true else return false. On top of it I need to pass the file into this check function. I'm trying to only use bash.
is_file_contains_VAR(){
VARFILENAME=$1
while read LINE
do
if echo "$LINE" | grep -q "$VAR"; then
break
return 0
else
return 1
fi
done < $VARFILENAME
}
break
might do.... – Ray Toal Feb 23 at 23:41return 0
won't be executed in that case. – Ray Toal Feb 23 at 23:44