Joshua1:8

לֹא־יָמוּשׁ סֵפֶר הַתּוֹרָה הַזֶּה מִפִּיךָ וְהָגִיתָ בּוֹ יוֹמָם וָלַיְלָה לְמַעַן תִּשְׁמֹר לַעֲשׂוֹת כְּכָל־הַכָּתוּב בּוֹ כִּי־אָז תַּצְלִיחַ אֶת־דְּרָכֶךָ וְאָז תַּשְׂכִּיל׃

This book of the Torah shall not depart from your mouth, and you shall meditate on it day and night, so that you may keep and do all that is written in it, for then you will make your way prosper, and then you will act wisely.

Joshua 1:8

לֹא־יָמוּשׁ סֵפֶר הַתּוֹרָה

Yehoshua / Joshua 1:8 · Pshat

Joshua 1:8

לֹא־יָמוּשׁ סֵפֶר הַתּוֹרָה הַזֶּה מִפִּיךָ וְהָגִיתָ בּוֹ יוֹמָם וָלַיְלָה לְמַעַן תִּשְׁמֹר לַעֲשׂוֹת כְּכָל־הַכָּתוּב בּוֹ כִּי־אָז תַּצְלִיחַ אֶת־דְּרָכֶךָ וְאָז תַּשְׂכִּיל׃

This book of the Torah shall not depart from your mouth, and you shall meditate on it day and night, so that you may keep and do all that is written in it, for then you will make your way prosper, and then you will act wisely.

Pshat פְּשָׁט

A commandment or a blessing

Telling someone "study day and night" can be an order or a wish. The Radak tells that the sages argued over which of the two was said to Yehoshua (Joshua).

Rashi: the book of Mishneh Torah lay before Yehoshua, and "meditate" means to look into it with the heart. The Radak: the sages argued whether this is a commandment or a blessing. In his view, it is a commandment to Yehoshua and to every person until he knows the Torah, and afterwards let him study the sciences. Metzudat David: let the Torah not depart from your mouth, or something will be forgotten.

How Rashi, Radak, and Metzudat David explain it

Rashi This book of the Torah

The book of Mishneh Torah was before him.

Radak Shall not depart

Our teachers, of blessed memory, disagreed about this verse. Some say it is a commandment for all the days of a person, even if he knows the entire Torah. And some say it is a blessing. And it seems that it was a commandment to Yehoshua, and so to every person, until he knows the Torah, and after that let him study the sciences.

Rashi And you shall meditate on it

And you shall look into it. All meditation (הִגָּיוֹן) in the Torah is in the heart, as it says: "and the meditation of my heart before You" (Tehillim / Psalms 19:15), "your heart shall meditate on terror" (Yeshayahu / Isaiah 33:18).

Metzudat David So that you may keep

For when [the Torah] departs from your mouth, you might forget something.

Takeaway

Mishneh Torah is a name for the book of Devarim (Deuteronomy), the last of the five books of the Torah. Rashi says that this is the book that lay before Yehoshua.
One view of this debate appears in the Talmud: even one who reads the Shema in the morning and the evening has fulfilled "shall not depart" (Menachot 99b).