GrandFather gave you the idea for the general case, but I'd note that -w implies -e, so you only need to test for writeability. Moreover, you'd probably make the printed message parametric as well, otherwise it will make sense only when you pass "-e" (as sk implicitly notes changing the message).