Abu Bamba was holding a kitchen knife with a 16 inch blade when he lunged towards the man leaving the BFC takeaway on Cherry Row in east Leeds, Leeds Crown Court heard.
Prosecutor, Beverley Wright said the victim saw Bamba, 51, sat on the pavement outside the shop with two suitcases and said he was selling shoes.
Mrs Wright said the man saw Bamba was holding a knife as he walked past him, adding: He started to lunge towards (the victim.) He was terrified and thought he was going to be stabbed.
"The defendant didn't say anything and he didn't know why he was doing it. The defendant was agitated.
"The defendant then stopped and went back and sat down near to his suitcases."
The victim called police and Bamba, who had two knives, was handcuffed and arrested.
Mrs Wright said: "The defendant was interviewed and accepted fully what happened.
"He said he had the items for his own protection because previously people had stolen items from the suitcases.
"He believed at the time he was going to steal from him. He said it was the potato peeler he had used."
Bamba, of Easterly Mount, admitted making threats with a bladed article.
He has four previous convictions for seven offences, including criminal damage.
The court heard Bamba has a history of mental health problems.
Judge Simon Phillips QC said a psychiatric report had been completed which concluded he did not need to be made the subject of a hospital order.
Judge Phillips sentenced Bamba to a 12 month jail sentence, suspended for 18 months.
Bamba must complete a nine month mental health treatment requirement and 15 rehabilitation activity days.