Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ghidinelli/6221e0b126f934fdcd1b3b54074691da to your computer and use it in GitHub Desktop.
Save ghidinelli/6221e0b126f934fdcd1b3b54074691da to your computer and use it in GitHub Desktop.
Open Chrome on Mac OSX to Google Flights with criteria pre-filled for batch searching
#!/bin/bash
[ "$#" -eq 1 ] || (echo "Destination airport code(s) (e.g. 'RNO' or 'RNO DEN') argument required" && exit 1)
for destination in "$@"
do
for origin in SFO AVL,GSP AUS MKE MEM DEN ONT IAD
do
if [ "$destination" = "$origin" ]; then
echo "No flight required for $origin -> $destination"
else
echo "Opening $origin -> $destination"
echo "https://www.google.com/flights#flt=$origin.$destination.2018-09-16*$destination.$origin.2018-09-22;co:1;c:USD;e:1;sd:1;t:f"
fi
done
done
@ghidinelli
Copy link
Author

I wrote this script for planning a remote team retreat. We were reviewing possible locations and wanted to ballpark what it cost to fly the team there. The origin list represent our team's home airports.

Typing ./teamtrip.bash ATL for example, would open up 8 chrome tabs, one each with the flight combinations of origin + ATL using the dates of 2018-09-16 to 2018-09-22. Obviously this could be more parameterized but it works a treat vs. opening up browser tabs and doing it by hand.

@ghidinelli
Copy link
Author

It also works to do ./teamtrip.bash ATL DEN MSY to check atlanta, denver and new orleans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment