Stephen Stokes was homeless when held up Kernan's Spar at Lower Main Street in Letterkenny, Co Donegal.
The 29-year-old Dubliner appeared at Letterkenny Circuit Court where he pleaded guilty to robbery on July 8th, 2019.
Stokes burst into the shop around 10.30pm and threw a plastic shopping bag at terrified shop assistant Mark Hegarty and told him to fill it with money.
Mr Hegarty put €600 in the bag as well as five packets of cigarettes.
Stokes had told his girlfriend to stand outside the shop and to keep watch.
The accused told Mr Hegarty that he knew where he lived and not to call the Gardai for half an hour after he left.
He told another terrified customer not to call the Gardai for half an hour also.
Gardai launched an investigation into the raid and recognised Stokes who was not wearing a mask from CCTV.
The following day he was arrested in a nearby hostel and was very abusive to Gardai, the court was told.
Some of the cigarettes were recovered but none of the cash was ever found.
Barrister for Stokes, Mr Sean McGee, said he had suffered from various addictions growing up in the north Dublin suburb of Finglas.
He did not have an idyllic upbringing but his parents, who were both in court, continued to support him and he considers them role models, Mr McGee added.
The court heard that while in prison Stokes has now started to study psychology and is trying to turn his life around.
Stokes, who pleaded guilty to a single count of robbery, took to the witness box and said he wanted to apologise for what he had done.
"I want to apologise from the bottom of my heart, I was in a bad place at the time. I even dream about it some nights.
"I want to apologise to the Gardai for my aggression and what I did. I will try to make up for it every day of my life," he said.
Passing sentence, Judge John Aylmer said he placed the incident at the lower end of the mid range for such offences and one which merited five years before mitigation.
He said that using a knife during the robbery and putting the shop assistant in fear made this a very serious offence.
However, he noted an early guilty plea and the fact that he was homeless at the time and reduced the headline sentence to one of four years.
He added that he needed to give Stokes some incentive for rehabilitation for his drug addiction and said he would suspend the sentence by a further twelve months if he entered a bond to undergo drug treatment and to keep the peace for two years when released from prison.
In total Stokes will serve three years.