أَخْبَرَنَا مُحَمَّدُ بْنُ أَحْمَدَ، حَدَّثَنَا سُفْيَانُ، عَنْ دَاوُدَ بْنِ شَابُورَ، سَمِعَ شَهْرَ بْنَ حَوْشَبٍ، يَقُولُ: قَالَ لُقْمَانُ لِابْنِهِ: "يَا بُنَيَّ، لَا تَعَلَّمْ الْعِلْمَ لِتُبَاهِيَ بِهِ الْعُلَمَاءَ، أَوْ تُمَارِيَ بِهِ السُّفَهَاءَ، وَتُرَائِيَ بِهِ فِي الْمَجَالِسِ، وَلَا تَتْرُكْ الْعِلْمَ زَهَادَةً فِيهِ، وَرَغْبَةً فِي الْجَهَالَةِ، وَإِذَا رَأَيْتَ قَوْمًا يَذْكُرُونَ اللَّهَ، فَاجْلِسْ مَعَهُمْ، إِنْ تَكُنْ عَالِمًا يَنْفَعْكَ عِلْمُكَ، وَإِنْ تَكُنْ جَاهِلًا عَلَّمُوكَ، وَلَعَلَّ اللَّهَ أَنْ يَطَّلِعَ عَلَيْهِمْ بِرَحْمَتِهِ فَيُصِيبَكَ بِهَا مَعَهُمْ، وَإِذَا رَأَيْتَ قَوْمًا لَا يَذْكُرُونَ اللَّهَ فَلَا تَجْلِسْ مَعَهُمْ، إِنْ تَكُنْ عَالِمًا لَمْ يَنْفَعْكَ عِلْمُكَ، وَإِنْ تَكُنْ جَاهِلًا زَادُوكَ غَيًّا أَوْ عِيًّا وَلَعَلَّ اللَّهَ أَنْ يَطَّلِعَ عَلَيْهِمْ بِسَخَطٍ فَيُصِيبَكَ بِهِ مَعَهُمْ".
Dawud bin Sabur heard Shahr bin Hawshab say: Luqman (peace be upon him) said to his son: O my son! Do not learn knowledge in order to show off with it, and do not abandon knowledge out of disinterest and inclination towards ignorance. And when you see a group remembering Allah, sit with them; if you are knowledgeable, your knowledge will benefit you, and if you are ignorant, they will make you aware. And it may be that Allah casts a merciful glance upon them and you also receive a share of it with them. And if you see a group who are heedless of Allah's remembrance, do not sit with them, for even if you have knowledge, your knowledge will not benefit you, and if you are ignorant, they will only increase you in misguidance or helplessness. And it may be that Allah turns towards them in anger, and you also become included in that anger.