The Confederate forces attacked Shiloh with a source of approximately 43,000 men under the command of Generals Albert Johnston and Gustave Beauregard. The Confederate forces under Beauregard were stationed in Corinth, and knowing the location of Grant's forces near Pittsburg Landing, thought it best to attack. Beauregard hoped to profit by capturing the Federal supplies, thus enabling the defense of Corinth against the approaching Federal General Don Carlos Buell and his forces. A victory at Shiloh was essential for Confederate troops to adequately defend Corinth.