“The ultimate courage is fighting a battle one knows they will lose; but they confront the adversary, to prevent them from winning.”
1978
Related quotes

As quoted in Honor Your Gifts (2007) by Dona M. Deane, p. 199.
Variant: But there is suffering in life, and there are defeats. No one can avoid them. But it's better to lose some of the battles in the struggles for your dreams than to be defeated without ever knowing what you're fighting for

Variant translations
If you know others and know yourself, you will not be imperiled in a hundred battles; if you do not know others but know yourself, you win one and lose one; if you do not know others and do not know yourself, you will be imperiled in every single battle.
Know your enemy and know yourself, find naught in fear for 100 battles. Know yourself but not your enemy, find level of loss and victory. Know not thy enemy nor yourself, wallow in defeat every time.
Literal translation: Know [the] other, know [the] self, hundred battles without danger; not knowing [the] other but know [the] self, one win one loss; not knowing [the] other, not knowing [the] self, every battle must [be] lost.
Source: The Art of War, Chapter III · Strategic Attack

Variant translations
Hence to fight and conquer in all your battles is not supreme excellence; supreme excellence consists in breaking the enemy's resistance without fighting.
The best victory is when the opponent surrenders of its own accord before there are any actual hostilities... It is best to win without fighting.
Source: The Art of War, Chapter III · Strategic Attack

“Don't fight a battle if you don't gain anything by winning.”
This is cited to to Rommel's Infanterie Greift An [Infantry Attacks] (1937) in World War II : The Definitive Visual History (2009) by Richard Holmes, p. 128, and Timelines of History (2011) by DK Publishing, p. 392, but to George S. Patton, in Patton's Principles : A Handbook for Managers Who Mean It! (1982) by Porter B. Williamson as well as Leadership (1990) by William Safire and Leonard Safir, p. 47
Disputed
Source: Rommel: In His Own Words

“Don't fight a battle if you don't gain anything by winning.”
This is cited to Patton in Patton's Principles : A Handbook for Managers Who Mean It! (1982) by Porter B. Williamson as well as Leadership (1990) by William Safire and Leonard Safir, p. 47, but is also cited to Erwin Rommel from his Infanterie Greift An [Infantry Attacks] (1937) in World War II : The Definitive Visual History (2009) by Richard Holmes, p. 128, and Timelines of History (2011) by DK Publishing, p. 392
Disputed