diff options
author | julien | 2009-07-24 10:11:49 +0200 |
---|---|---|
committer | julien | 2009-07-24 10:11:49 +0200 |
commit | 9c97b6cbe937c09d88a0177654d12ed2acc712a3 (patch) | |
tree | 8ef9d11cd8c58b3ecc67eec9a5fad78e124ae9cb /shtrains.sh | |
parent | Fixed the trains script to handle canceled trains and wrote the help command. (diff) | |
download | shbot-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 '')
-rwxr-xr-x | shtrains.sh | 13 |
1 files changed, 10 insertions, 3 deletions
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 |