 He graduated from the medical department of the University of Maryland, Baltimore in 1864, and practiced medicine in Uniontown, Maryland, until November 1873.He was elected clerk of the circuit court for Carroll County, Maryland, in 1873, was reelected in 1879, and served until 1885, when he resigned.Shaw was elected as a Democrat to the 49th and 50th Congresses, serving from March 4, 1885, to March 3, 1889.