diff --git a/include/functions b/include/functions index 0a19f11c..b6cdc3bf 100644 --- a/include/functions +++ b/include/functions @@ -2209,12 +2209,13 @@ # Description : Search if a specific string exists in in a file # # Input : $1 = search key (string), $2 = file (string) - # Returns : + # Returns : True (0) or False (1) ################################################################################ SearchItem() { - ITEM_FOUND=0 - if [ $# -eq 2 ]; then + ITEM_FOUND=0 + RETVAL=1 + if [ $# -eq 2 ]; then # Don't search in /dev/null, it's too empty there if [ -f $2 ]; then # Check if we can find the main type (with or without brackets) @@ -2224,16 +2225,19 @@ ITEM_FOUND=1 LogText "Result: found string" LogText "Full string: ${FIND}" + RETVAL=0 else LogText "Result: search string NOT found" + RETVAL=1 fi else LogText "Skipping search, file does not exist" ReportException ${TEST_NO} "Test is trying to search for a string in nonexistent file" fi - else + else ReportException ${TEST_NO} "Error in function call to CheckItem" - fi + fi + return ${RETVAL} }