summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjulien2009-07-24 10:11:49 +0200
committerjulien2009-07-24 10:11:49 +0200
commit9c97b6cbe937c09d88a0177654d12ed2acc712a3 (patch)
tree8ef9d11cd8c58b3ecc67eec9a5fad78e124ae9cb
parentFixed the trains script to handle canceled trains and wrote the help command. (diff)
downloadshbot-9c97b6cbe937c09d88a0177654d12ed2acc712a3.tar.gz
shbot-9c97b6cbe937c09d88a0177654d12ed2acc712a3.tar.bz2
shbot-9c97b6cbe937c09d88a0177654d12ed2acc712a3.zip
Fixed the trains script by changing the parsing strategy; added some responses to shbrain.
Diffstat (limited to '')
-rw-r--r--shbrain.txt4
-rwxr-xr-xshtrains.sh13
2 files changed, 14 insertions, 3 deletions
diff --git a/shbrain.txt b/shbrain.txt
index 4ebf14d..8a11925 100644
--- a/shbrain.txt
+++ b/shbrain.txt
@@ -4,4 +4,8 @@ plop 100 pataplop
:([a-zA-Z]*)!.*:.*(shbot|julien|root).*(fuck|merde) 100 You, fuck you ${BASH_REMATCH[1]}...
:([a-zA-Z]*)!.*:.*(clex|galdor).*(fuck|merde|suck) 100 You are right ${BASH_REMATCH[1]}, fuck you ${BASH_REMATCH[2]}.
+:([a-zA-Z]*)!.*:.*([Tt]a.*gueule|tg).*shbot 100 Fuck you ${BASH_REMATCH[1]}...
+:([a-zA-Z]*)!.*:.*(bfb|brainfuck.*bot).*il\ pue 100 Listen to shbot, the one true Bot!
+:([a-zA-Z]*)!.*:.*Who\ are\ you\ shbot 100 The One True Bot!
+:([a-zA-Z]*)!.*:.*merci\ .*shbot 100 The One True Bot at your service ${BASH_REMATCH[1]}!
diff --git a/shtrains.sh b/shtrains.sh
index 2f1936f..7b9b2d0 100755
--- a/shtrains.sh
+++ b/shtrains.sh
@@ -1,18 +1,25 @@
#!/bin/bash
-links -dump 'http://transilien.mobi/pam/TempReelSaisieDepartSubmit.do?debutDepart=Courbevoie&tous=Tous+trains' | head -n 22 | tail -n 18 >trains.tmp
+links -dump 'http://transilien.mobi/pam/TempReelSaisieDepartSubmit.do?debutDepart=Courbevoie&tous=Tous+trains' >trains.tmp
cat trains.tmp | \
while true
do
- read PATTERN || break
+ while true
+ do
+ read PATTERN || break
+ if [[ $PATTERN =~ \ *[A-Z]{4}\ *(.*)\ *Voie ]]; then
+ PATTERN=${BASH_REMATCH[1]}
+ break
+ fi
+ done
read STATION || break
read UGUU || break
- [[ $PATTERN =~ \ *[A-Z]{4}\ *(.*) ]] && PATTERN=${BASH_REMATCH[1]}
if [[ $UGUU =~ Supprime ]]; then
read UGUU || break
continue
fi
+ #[[ $STATION =~ Versailles\ Rive\ Droite ]] && STATION="Versailles Rive Droit"
if [ -n "$*" ]; then
[[ $STATION =~ $@ ]] && echo "$PATTERN $STATION"
else