This is a script to get driving directions in text form rather then having to open a browser. It uses google directions javascript API to actually find the directions. To use it

  1. Pass the from and to addresses on the command line, like:
    % directions from to
  2. Put the from address in ~/.directions for convenience and only pass the to address:
    % directions to
  3. Or, pass empty arguments and you'll be prompted for the addresses:
    % directions
    From: from
    To: to

Here's an example finding directions from New York to LA:

% directions -o 'New York,NY,10019' 'Los Angeles,CA,90001'
Distance: 2,784 mi
Duration: 1 day 19 hours

Distance   Duration   Directions
187 ft     1 min      Head northwest on W 55th St toward 11th Ave
0.8 mi     4 mins     Take the 1st left onto 11th Ave
299 ft     1 min      Turn left at W 40 St
0.7 mi     1 min      Take the ramp onto NY-495 W 
 --- Entering New Jersey ---
3.3 mi     3 mins     Continue onto NJ-495 W
0.2 mi     1 min      Take the exit toward I-95 S
6.2 mi     6 mins     Keep left at the fork to continue toward 
                      I-95 S and merge onto I-95 S 
 --- Partial toll road ---
138 mi     2 hours 6 mins Take exit 14-14C to merge onto I-78 W 
                          toward US-1/US-9/US-22/Newark Airport 
 --- Partial toll road ---
 --- Entering Pennsylvania ---
36.6 mi    34 mins    Merge onto I-81 S
0.2 mi     1 min      Take exit 52 for US-11 toward I-76/New 
1.0 mi     2 mins     Keep right at the fork, follow signs for US-11 
                      and merge onto Harrisburg Pike/US-11 S
152 mi     2 hours 21 mins Take the ramp onto I-76 W 
 --- Partial toll road ---
614 mi     9 hours 25 mins Take exit 75 to merge onto I-70 W 
                           toward Wheeling WV 
 --- Partial toll road ---
 --- Passing through West Virginia, Ohio, Indiana, Illinois ---
 --- Entering Missouri ---
379 mi     5 hours 49 mins Take exit 40C to merge onto I-44 W/I-55 S 
 --- Continue to follow I-44 W ---
 --- Partial toll road ---
 --- Entering Oklahoma ---
107 mi     1 hour 38 mins Take exit 34 to merge onto I-44 W/US-412 W 
                          toward OK-66/Tulsa 
 --- Continue to follow I-44 W ---
11.2 mi    10 mins    Take the exit on the left onto I-35 
                      S/I-44 W toward Okla. City/Downtown 
 --- Continue to follow I-35 S ---
1,214 mi   18 hours 37 mins Continue onto I-40 W 
 --- Passing through Texas, New Mexico, Arizona ---
 --- Entering California ---
72.6 mi    1 hour 7 mins Merge onto I-15 S
38.9 mi    36 mins    Take the exit onto I-10 W toward Los Angeles
0.9 mi     1 min      Take the I-10 W/I-5 S exit toward Santa 
                      Monica/Santa Ana
2.8 mi     3 mins     Follow signs for Santa Monica and merge onto 
                      I-10 W/I-5 S 
 --- Continue to follow I-10 W ---
0.2 mi     1 min      Take exit 15B toward Alameda St
220 ft     1 min      Merge onto E 14th St
3.5 mi     9 mins     Turn left at S Alameda St
0.6 mi     1 min      Turn right at E Florence Ave
0.3 mi     1 min      Turn left at Miramonte Blvd
394 ft     1 min      Turn right at E 77th St 
 --- Destination will be on the left ---

Here are the full usage instructions:

Usage: directions [options] origin? destination?
where options include:
 -o   Over ride and don't use address in ~/.directions
 -h   Print this message
 -v   Be loud
You can put a home address in ~/.directions.  If this address
exists it will used as the origin address.  You can over ride
using this address with the -o option.  If no home address
is exists in ~/.directions and none is given as an argument
we prompt for it.  If no destination address is given on the
command line, we prompt for it.