From bba7cfe20008ffca4a2fb97da137892cb72f45e6 Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Thu, 11 Aug 2016 18:46:17 +0200 Subject: [PATCH] Add return value to SearchItem() function --- include/functions | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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} }