Text:

नाविरतो दुश्चरितान्नाशान्तो नासमाहितः ।
नाशान्तमानसो वापि प्रज्ञानेनैनमाप्नुयात् ॥ २४ ॥

nāvirato duścaritānnāśānto nāsamāhitaḥ |
nāśāntamānaso vāpi prajñānenainamāpnuyāt || 24 ||

24. None who has not turned away from bad conducts whose senses are not under control, whose mind is not collected, or whose mind is not at rest, can attain this atman by knowledge.

Shankara’s Commentary:

Yet something more: who has not turned away from bad conduct, i.e., from sinful acts prohibited and not permitted by the srutis and the smritis, who has no quietude from the activity of the senses, whose mind is not concentrated, i.e., whose mind is deverted off and on; whose mind is not at rest, i.e., whose mind, though collected, is engaged in looking forward to the fruits of being so collected, cannot attain the atman now treated of, but only by means of the knowledge of Brahman; the meaning is that he alone who has turned away from bad conduct, who is free from the activity of the senses, whose mind is collected, and whose mind is at rest, even in respect of the fruits of its being so collected, taught by a preceptor, attains the atman above described by knowing him.