A flasher was warned that he will go to jail if he exposes himself again.
The message came as a judge heard that Kevin Bramhall, 59, is already on the Sex Offenders' Register for life.
A three-year probation order was imposed on Bramhall of High Street, Sutton, who appeared at Nottingham Crown Court. He pleaded guilty to exposing himself in Hucknall.
The offence took place at 1.20pm on November 14 when he was first seen loitering around a car park, said Mark Watson, prosecuting. He was noticed for around for 20 minutes.
Then he sat on a grass verge between his car and another vehicle where he was seen by an elderly couple.
"His jogging bottoms were down around his ankles," said Mr Watson.
One of the pensioners shouted at Bramhall, prompting him to get into his car and drive away.
But one witness had managed to take a photograph of the car, enabling police officers to trace Bramhall.
Mr Watson added: "The man was left particularly angered by what he had seen and angered because he was concerned by what his wife had been having to see.
"She described herself realising her vulnerabilities having seen that and was shocked."
The court heard that Bramhall had an earlier conviction for exposure as well as indecent assault. That led to his name being added to the Sex Offenders' Register permanently.
Judge James Sampson told Bramhall: "Ordinarily offences of this kind are regarded by the courts as nuisance offences.
"But against your background, which aggravates your position markedly, this offence is well beyond nuisance. You caused clear distress to two members of the public.
"Should this happen again, you will not get the opportunity I am about to give you.
"You will go on a sex offenders' programme. If you fail to do the work provided, you will be brought back to court and the sentence will be an immediate sentence of imprisonment.
"This is a direct alternative to going to jail," the judge added.
David Outterside, mitigating, said that Bramhall accepted the terms of a sex offences prevention order which was imposed by the judge.
Making Bramhall attend a sex offenders' course was a "better method" than sending him to prison, added Mr Outterside.