There are some interesting points made here about the jews and knowing other gods. The indications are however that the jews had long known their god Yahweh. When it was mentioned that Moses needed to ask the name of the god who was sending him to Egypt it wasn't because he didn't know the name of the god of the jews. Discussing this matter the bible commentator Matthew Henry states:
1. From God's name, Jehovah, v. 2, 3. He begins with this, I am Jehovah, the same with, I am that I am, the fountain of being, and blessedness, and infinite perfection. The patriarchs knew this name, but they did not know him in this matter by that which this name signifies. God would now be known by his name Jehovah, that is, (1.) A God performing what he had promised, and so inspiring confidence in his promises. (2.) A God perfecting what he had begun, and finishing his own work. In the history of the creation, God is never called Jehovah till the heavens and the earth were finished, Gen. ii. 4.
Remember that the jews had been slaves in Egypt for some time. Their God had left them there. The gods of the Egyptians seemed to be stronger. What confidence could the jews have for deliverance. By giving the name, Yahweh was showing that he would now prove himself. Some state the the name should be translated I shall prove to be, what I shall prove to be, and not I am, that I am. Since in effect god was saying I shall prove to be whatever I need to be to deliver my people, which was something that the jews had not seen of Yahweh whilst in captivity.
So why say that they should not worship any other gods in the ten commandments. The jews would know of the gods of Egypt and they witnessed the fact that they could not stop the deliverance of the jewish nation. They would learn of new gods in the land of Canaan, but these gods would not be able to stop Jahweh bringing the jews into the promised land and dispossessing their worshipers of their lands. Since no other gods where able to stop Yahweh why should he share his worship with them? Hence the law that the jews should not worship them.