added logic for in stock and message

This commit is contained in:
2022-01-27 18:13:29 -05:00
parent 90372fbd6a
commit 14304bf2aa

View File

@@ -7,5 +7,10 @@ SOURCE_FILE='/tmp/source.html'
wget -O ${SOURCE_FILE} ${URL}
GREP_RESULTS=$(grep -o '"inventory_quantity":.,' ${SOURCE_FILE} | grep -o '[0-9]\+')
INVENTORY_QUANTITY=$(grep -o '"inventory_quantity":.,' ${SOURCE_FILE} | grep -o '[0-9]\+')
if [[ ${INVENTORY_QUANTITY} -gt 0 ]]; then
MESSAGE="There are currently ${INVENTORY_QUANTITY} in stock. ${URL}"
echo ${MESSAGE}
fi