Archived
1
0
Fork 0
This repository has been archived on 2025-03-10. You can view files and clone it, but cannot push or open issues or pull requests.
shbot/shtrains.sh

25 lines
524 B
Bash
Raw Normal View History

2009-07-06 17:26:39 +02:00
#!/bin/bash
2009-07-07 09:56:53 +02:00
links -dump 'http://transilien.mobi/pam/TempReelSaisieDepartSubmit.do?debutDepart=Courbevoie&tous=Tous+trains' | head -n 22 | tail -n 18 >trains.tmp
2009-07-06 17:26:39 +02:00
2009-07-07 09:56:53 +02:00
cat trains.tmp | \
while true
do
read PATTERN || break
read STATION || break
read UGUU || break
[[ $PATTERN =~ \ *[A-Z]{4}\ *(.*) ]] && PATTERN=${BASH_REMATCH[1]}
if [[ $UGUU =~ Supprime ]]; then
read UGUU || break
continue
fi
2009-07-07 09:56:53 +02:00
if [ -n "$*" ]; then
[[ $STATION =~ $@ ]] && echo "$PATTERN $STATION"
else
echo "$PATTERN $STATION"
fi
done
2009-07-06 17:26:39 +02:00
exit 0