checkLocationExists () {
pathWithShieldingSlash=$(echo "$1" | sed 's/\//\\\//g')
isPathExists=$(sed -n 's/.*\(location '"$pathWithShieldingSlash"'.*\).*{/\1/p' "$locations_path/$file_name")
if [[ -z $isPathExists ]]; then
return 0
else
return 1
fi
}
test=$(checkLocationExists "$path")
if [[ "$test" = true ]]; then
echo "FOUND"
else
echo "NOT FOUND"
fi
NOT FOUND
if checkLocationExists "$path"; then
echo "FOUND"
else
echo "NOT FOUND"
fi
checkLocationExists () {
pathWithShieldingSlash=$(echo "$1" | sed 's/\//\\\//g')
isPathExists=$(sed -n 's/.*\(location '"$pathWithShieldingSlash"'.*\).*{/\1/p' "$locations_path/$file_name")
return [[ -z $isPathExists ]]
}
if checkLocationExists "$path"; then
echo ok
fi
#или
checkLocationExists "$path" && echo ok