Deuteronomy 5:32
31 But as for you, remain here with me so I can declare to you all the commandments, statutes, and ordinances that you are to teach them, so that they can carry them out in the land I am about to give them.” 32 Be careful, therefore, to do exactly what the Lord your God has commanded you; do not turn right or left! 33 Walk just as he has commanded you so that you may live, that it may go well with you, and that you may live long in the land you are going to possess.
Joshua 1:7
6 Be strong and brave! You must lead these people in the conquest of this land that I solemnly promised their ancestors I would hand over to them. 7 Make sure you are very strong and brave! Carefully obey all the law my servant Moses charged you to keep. Do not swerve from it to the right or to the left, so that you may be successful in all you do. 8 This law scroll must not leave your lips. You must memorize it day and night so you can carefully obey all that is written in it. Then you will prosper and be successful.
Notes and References
"... This Mosaic torah becomes, in turn, the mandate for all of Joshua’s actions and his legacy to future generations (Joshua 1:7, 8; 8:31, 32, 34, 35; 22:5; 23:6; 24:26) ... The Deuteronomistic historian, of course, did not leave the matter at that, but presented Josiah’s discovery and implementation of the Mosaic torah as the climax of his work (2 Kings 22:8, 11; 23:24–25). That he portrayed Joshua as a unique prototype for Josiah’s strict obedience to Deuteronomic law is shown by the distribution of the admonition found in Joshua 1:7 regarding that torah: “Turn not from it to the right hand or to the left.” This admonition to keep to the legal straight and narrow is used four times in Deuteronomy (5:32; 17:11, 20 [the “law of the king”]; 28:14), and again in Joshua’s farewell address to Israel (Joshua 23:6). It does not recur in the Deuteronomistic History until Josiah is said to have fulfilled it (2 Kings 22:2) ..."
Cheney, Marvin L. "Joshua" in Anderson, Bernhard W. (ed.) The Books of the Bible, Vol. 1: The Hebrew Bible (pp. 109-110) Scribner's, 1989