#!/bin/bash ## Get website data with curl ## Change Store location to closest location costco_gateshead_site=$(curl -s https://www.costco.co.uk/store-finder/Gateshead) ## Grep text from website for different fuel costco_diesel=$(echo $costco_gateshead_site | grep -oP '"gas-title">Premium Diesel \K.*' | grep -oE '^.{5}') costco_premium_unleaded=$(echo $costco_gateshead_site | grep -oP '"gas-title">Premium Unleaded Petrol \K.*' | grep -oE '^.{5}') costco_unleaded=$(echo $costco_gateshead_site | grep -oP '"gas-title">Unleaded Petrol \K.*' | grep -oE '^.{5}') ## Print fuel prices # echo "Premium Diesel - $costco_diesel p" # echo "Premium Unleaded - $costco_premium_unleaded p" # echo "Unleaded - $costco_unleaded p" # Set the variables title="Costco UK Fuel Prices" # Generate the HTML output cat < ./index.html ${title} ${title} Premium Diesel ${costco_diesel}p Premium Unleaded ${costco_premium_unleaded}p Unleaded ${costco_unleaded}p EOF
${costco_diesel}p
${costco_premium_unleaded}p
${costco_unleaded}p