hafa.sh – shell script that fetches train connections
8 grudnia 2011
Posted by w dniu
hafa.sh is a small shell script for Unix-based systems that fetches train connections between two stations. It has both command-line and basic graphic interface (using GTK+/Zenity – zenity is required to use it). cURL is also required, as the script uses it to fetch connection data.
All connections that are included in HAFAS system and, specifically, one of its Polish implementations are available – that means the script can find railway connections within much of Europe.
To run it, start your terminal, navigate to the folder where it is downloaded, give it the execution permission (chmod +x hafa.sh) and input one of the following commands:
./hafa.sh -w //window mode
./hafa.sh -i //command-line ‚interactive’ mode
./hafa.sh -a Departure_station -b Arrival_station -d Date -t Time //direct input
./hafa.sh -h //help with description of above and even more arguments
You don’t have to input date and time – if you don’t do it, your system time will be used.
The script can be downloaded from its Sourceforge.net project page. It was written as a university assignment, but as I like the result I decided to release it online.
Current version has some minor bugs and lacks some features that might be useful (ie. information about the exact time and place of a layover), but is quite usable for a basic script. Of course, any improvement suggestions are welcome.