Al-Muzanī reports:
I heard Al-Shāfiʿī say:
A man once asked Ubay b. Kaʿb – Allāh be pleased with him, “Exhort me with something I can benefit by and by which I will be rewarded.” He replied, “Be brotherly with brothers according to how righteous they are, do not expend your speech on those who are not interested in it, do not seek anyone to meet your need who does not care if he does not fulfil it, and do not envy the living except for something you would envy the dead.”
Al-Ājurrī, Juz fīhi Ḥikāyāt ʿan Al-Shāfiʿī article 24.