Add return value to SearchItem() function

This commit is contained in:
Michael Boelen 2016-08-11 18:46:17 +02:00
parent ed4dd3bf60
commit bba7cfe200
1 changed files with 9 additions and 5 deletions

View File

@ -2209,11 +2209,12 @@
# Description : Search if a specific string exists in in a file
#
# Input : $1 = search key (string), $2 = file (string)
# Returns : <nothing>
# Returns : True (0) or False (1)
################################################################################
SearchItem() {
ITEM_FOUND=0
RETVAL=1
if [ $# -eq 2 ]; then
# Don't search in /dev/null, it's too empty there
if [ -f $2 ]; then
@ -2224,8 +2225,10 @@
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"
@ -2234,6 +2237,7 @@
else
ReportException ${TEST_NO} "Error in function call to CheckItem"
fi
return ${RETVAL}
}