diff --git a/osteria.sh b/osteria.sh new file mode 100755 index 0000000..3807d71 --- /dev/null +++ b/osteria.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +url="https://www.unasplzenchutna.cz/garage/cz/denni-nabidka/" +html_snippet=$(curl -s "$url") + +day_of_week=$(date '+%u') + +case "$day_of_week" in + 1) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1') + ;; + 2) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2') + ;; + 3) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3') + ;; + 4) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4') + ;; + 4) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5') + ;; + *) + echo "Spatnej den v tydnu brasko" + exit 1 + ;; +esac + +echo "Polévka:" +echo "$soup" +echo +echo "Hlavní chod:" +echo "$main_course" \ No newline at end of file diff --git a/sladovnicka.sh b/sladovnicka.sh new file mode 100755 index 0000000..118636f --- /dev/null +++ b/sladovnicka.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +url="https://sladovnicka.unasplzenchutna.cz/cz/denni-nabidka/" +html_snippet=$(curl -s "$url") + +day_of_week=$(date '+%u') + +case "$day_of_week" in + 1) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1') + ;; + 2) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2') + ;; + 3) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3') + ;; + 4) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4') + ;; + 4) + soup=$(echo "$html_snippet" | grep -oP '(?<=

Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5') + main_course=$(echo "$html_snippet" | grep -oP '(?<=

Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5') + ;; + *) + echo "Spatnej den v tydnu brasko" + exit 1 + ;; +esac + +echo "Polévka:" +echo "$soup" +echo +echo "Hlavní chod:" +echo "$main_course" \ No newline at end of file