reverted brackets and fixed grep

This commit is contained in:
2022-01-27 18:34:17 -05:00
parent c802b3969c
commit 619b48f164

View File

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