Homer's "D'oh!" came from a Laurel and Hardy villain

When Homer Simpson was still a short cartoon on The Tracey Ullman Show, a script asked him for an "annoyed grunt." Dan Castellaneta, who voices him, answered with a long "d'ooooooh." He based it on Jimmy Finlayson, a Scottish actor in 33 Laurel and Hardy films.
The Simpson family first appeared in 1987, in short cartoons on The Tracey Ullman Show. At one recording session, Homer's line in the script was not a word. It said "annoyed grunt." Dan Castellaneta, who voices Homer, had to decide what that sounded like. He made it a long, drawn-out "d'ooooooh."
He had it from Jimmy Finlayson. Finlayson was a Scottish actor, bald, with a fake moustache, who had worked as a tinsmith before he went on the stage. He reached Hollywood in 1916 and ended up at Hal Roach's studio. There he played in 33 Laurel and Hardy films, usually as the villain or their antagonist. In Big Business (1929) he is the homeowner who refuses to buy their Christmas tree, and the feud ends with his house and their car wrecked.
Finlayson's trademarks were a squinting, outraged double take and a drawn-out "D'ooooooh!" The sound stood in for "damn," a word that was unacceptable at the time.
Anthony Hopkins won Best Actor for playing which movie villain?
WhyHopkins won at the 1992 Oscars despite appearing on screen for only about 16 minutes in The Silence of the Lambs. It is one of the shortest performances ever to win the award.
Matt Groening, who created the show, thought the long version did not suit the timing of animation. He wanted it faster, so Castellaneta cut it down to a quick "D'oh!" The Simpsons got its own half-hour series on December 17, 1989, and Homer said it in the first episode. From then on he said it whenever he hurt himself or realized he had done something stupid.
Because it began as a stage direction, the word had no official spelling for years. Scripts wrote it as "(annoyed grunt)", and so did the titles of several episodes, such as "E-I-E-I-(Annoyed Grunt)" in 1999.
In 1998 "d'oh" entered the Oxford Dictionary of English. In 2001 it went into the Oxford English Dictionary, spelled "doh." The OED entry quotes eight uses of the sound, and two of them come from The Simpsons. The earliest is from a 1945 episode of a BBC radio comedy, It's That Man Again, where it was the catchphrase of a character called Miss Hotchkiss.