Lay an 8-inch piece of 1-by-2 lumber horizontally in front of you on the work bench, resting on a 1-inch edge.
Abut a piece of 7-inch 1-by-2 lumber vertically under the end of the 8-inch piece to form a right-angle. Check the angle with a carpenter's square.
Glue the 7-inch piece to the 8-inch piece and let dry.
Drill two pilot holes sized for 1 1/2-inch screws through the top of the 8-inch piece into the end of the 7-inch piece, then secure together with 1 1/2-inch screws.
Miter the ends of a 6-inch piece of 1-by-2 lumber to opposing 45-degree angles. The 7-inch side of the bracket is placed vertically on the wall where you want the shelf to go, with the 8-inch piece sticking out horizontally to support the shelf top. After securing the 7-inch piece to the wall as desired -- 2 1/2-inch screws into wall studs works well -- slot the 6-inch brace piece with the angled ends in between the 7- and 8-inch pieces. The angled ends will sit flush against both pieces.
Secure the angled 6-inch brace to the 7- and 8-inch pieces with two 1 1/2-inch screws driven around an inch in from the ends of the angled brace.