Variational minimization is one approach. The details of the proof would come down to what sort of space you're working in, though. Euclidian spaces are a lot simpler to prove this in than more complicated spaces with different notions of intrinsic and extrinsic curvature. For example, the shortest path on a sphere is also a line, but it's extrinsically curved and also might not be unique. On the other hand, the proof in a one-dimensional Euclidean space sort of comes from the definition of the metric over the space.