If the avocado is ripe and is ready to eat, then it yields to firm gentle pressure. You can also observe a subtle darkness in the outer layer. So, before you buy, try putting a firm pressure on the avocados and then make your buying decision.
Note: If you end up buying an unripe avocado, keep it inside a refrigerator for a day or two and keep checking the texture and colour and consume before it gets over ripe.