The Prophet ﷺ said: If anyone acquires knowledge that should be sought seeking the Face of Allah, but he acquires it only to get some worldly advantage, he will not experience the arf, i.e. the fragrance, of Paradise.
قَالَ رَسُولُ اللَّهِ ﷺ مَنْ تَعَلَّمَ عِلْمًا مِمَّا يُبْتَغَى بِهِ وَجْهُ اللَّهِ ﷻ لاَ يَتَعَلَّمُهُ إِلاَّ لِيُصِيبَ بِهِ عَرَضًا مِنَ الدُّنْيَا لَمْ يَجِدْ عَرْفَ الْجَنَّةِ يَوْمَ الْقِيَامَةِ يَعْنِي رِيحَهَا