A heroin addict told a security guard he would stab him with a needle and then spat in the man's face while trying to leave a Mansfield store with stolen goods.
Christopher Bickerton tried to steal £37 of padlocks from Home Bargains, on St Peter's Retail Park, on August 29, when he was challenged by the guard.
Prosecutor Daniel Pietryka said Bickerton threatened the guard, but had no needle on him, before spitting in his face.
The day before he refused to provide a saliva sample to test for Class A drugs, at Mansfield police station.
The court heard he was released from prison on August 9, and stole £16 of chargers from Home Bargains, on August 14, breaching the terms of his post-sentence supervision.
Rebecca Williams, mitigating, said: "He completely accepts all offences.
"Since his release he has fallen back into heroin and crack cocaine use, which he has been addicted to for 15 years.
"When he is clean he is a different person. He wants to get himself free of his drug use. He managed to get clean for a year when he had stable accommodation.
"Homelessness tends to trigger his drug use.
"It's his wish to go back to custody at this point. The shop thefts were committed to fund his drug use."
Bickerton, 38, of no fixed abode, admitted the offences, when he appeared at Mansfield Magistrates Court, on Friday.
Magistrates locked him up for 24 weeks, because he was "a darned nuisance to society," with 88 thefts and 61 offences relating to the police, the courts and prison on his record.
He was ordered to pay £100 compensation to the security guard and £16 to Home Bargains, which will be added to the £2,726 he owes to the courts.
Click here for more Mansfield crime stories.