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
2009-07-07 09:56:53 +02:00

20 lines
454 B
Bash
Executable file

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