Fixed two bugs
This commit is contained in:
parent
2f6e516856
commit
c62d25ec53
@ -1,4 +1,13 @@
|
||||
2014-01-03
|
||||
Version 0.1 - First release of the plugin
|
||||
|
||||
2013-01-04
|
||||
Version 0.2 - Fixed two bugs, whereas one important
|
||||
1. In case there more than one wheater alert for the specified
|
||||
region, the script would bug out. Fixed by adding 'head -n1'
|
||||
so that it always only shows the first warning issued.
|
||||
2. In case there were swedish characters (åäö) in the warning
|
||||
message they would output as their HTML-equivalent. Fixed
|
||||
with another sed substitue command.
|
||||
|
||||
|
||||
|
@ -21,14 +21,14 @@
|
||||
################################################################################
|
||||
|
||||
# check_smhi
|
||||
Version="0.1"
|
||||
Version="0.2"
|
||||
Author="Jack-Benny Persson (jack-benny@cyberinfo.se)"
|
||||
|
||||
# Binaries
|
||||
Which="/usr/bin/which"
|
||||
# Binaries entered in the list will be avalible to the script as variables with
|
||||
# the first letter uppercase
|
||||
Binaries=(sed awk egrep printf curl)
|
||||
Binaries=(sed awk egrep printf curl head)
|
||||
|
||||
# Variables
|
||||
District=""
|
||||
@ -214,13 +214,20 @@ s/Ö/\Ö\;/g
|
||||
}'`
|
||||
|
||||
# Get the line number for the current district in the HTML-file and add one line to it
|
||||
LineNr=`echo "$Data" | $Sed -n "/$HtmlDist/="`
|
||||
LineNr=`echo "$Data" | $Sed -n "/$HtmlDist/=" | $Head -n1`
|
||||
((LineNr++))
|
||||
|
||||
# Read the warning message (for example kuling, orkan, åska)
|
||||
WarnMsg=`echo "$Data" | $Sed -n "${LineNr}p" | $Egrep -o "Varning klass [0-3] .*" | \
|
||||
$Sed 's/\(.*\).........../\1/' | \
|
||||
$Awk '{print substr($0, index($0,$4))}'`
|
||||
$Awk '{print substr($0, index($0,$4))}' | $Sed '{
|
||||
s/\å\;/å/g
|
||||
s/\Å\;/Å/g
|
||||
s/\ä\;/ä/g
|
||||
s/\Ä\;/Å/g
|
||||
s/\ö\;/ö/g
|
||||
s/\Ö\;/Ö/g
|
||||
}'`
|
||||
|
||||
# Get the current warning class (1, 2 and 3)
|
||||
Class=`echo "$Data" | $Sed -n "${LineNr}p" | $Egrep -o "Varning klass [0-3]" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user