Every thing he [Shane]did was because he thought that was how he needed to be in the post-apocalyptic, post Rick, world. And, sometimes, he was right (the walker barn for example).
Not everything. As others have pointed out, some of it was selfishness due to him not having a family to live for. He wanted Lori, and if his best friend got in the way Shane rationalized that eliminating Rick was the best most sound decision for everyone.
In a way, you could argue that Merle was a better man than Shane. Shane and Rick had been friends since high school and were supposed to be like brothers. But Shane was willing to screw Rick over when the situation got desperate after the ZA. Not so Merle with Daryl.