A man who brought a hammer and a knife into a neighbouring kebab shop has avoided being sent to jail.