From 9c97b6cbe937c09d88a0177654d12ed2acc712a3 Mon Sep 17 00:00:00 2001 From: julien Date: Fri, 24 Jul 2009 10:11:49 +0200 Subject: Fixed the trains script by changing the parsing strategy; added some responses to shbrain. --- shbrain.txt | 4 ++++ shtrains.sh | 13 ++++++++++--- 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 -- cgit v1.2.3