Empirical determination of the shape of dust attenuation curves in star-forming galaxies