When a living person leaves, we do not say 'go b'Shalom', for David said so to Avshalom, and Avshalom died;
Rather, we say 'go l'Shalom', for Yisro said so to Moshe, and Moshe succeeded (to redeem Yisrael).
Berachos 27b (Beraisa - R. Eliezer): One who gives or returns Shalom to his Rebbi causes the Shechinah to depart from Yisrael.
Berachos 54a (Mishnah): Chachamim enacted to greet people with Hash-m's name - "Va'Yomer (Bo'az) la'Kotzrim Hash-m Imachem va'Yomru Lo Yevarechecha Hash-m";
It also says "Hash-m Imcha Gibor ha'Chayil", "V'Al Tavuz Ki Zoknah Imecha", "Es La'asos la'Shem Heferu Torasecha".
R. Noson says, they annulled Your Torah because (of a great need, i.e.) it was a time when we must do (so) for Hash-m.
63a - Question: Why do we need the other verses?
Answer: One might have thought that Bo'az did so on his own initiative, and we may not learn from him -- therefore, we need "Hash-m Imcha..."
Question: We cannot learn from there. Perhaps this was not a greeting, but rather the angel informed Gid'on that Hash-m was with him!
Answer: Therefore, we learn from "V'Al Tavuz Ki Zoknah Imecha" (do not suspect Chachamim like Bo'az of acting improperly);
They have authority to make such enactments - "Es La'asos la'Shem Heferu Torasecha."
Shabbos 89a (R. Yehoshua ben Levi): When Moshe ascended, he found Hash-m tying crowns to the letters.
Hash-m: People don't give Shalom in your city?! (Why didn't you greet Me?)
Moshe: Does a slave give Shalom to his master?!
Hash-m: You should help Me (give Me a Berachah).
Rif and Rosh (3:100): When a person leaves, we say 'go l'Shalom', for Yisro said so to Moshe, and Moshe succeeded. We do not say 'go b'Shalom', for David said so to Avshalom, and Avshalom died.
Nimukei Yosef (DH ha'Niftar): Go b'Shalom connotes that the trip will be peaceful, but not the end. Chachamim address people who are superstitious. One who is not concerned will not be harmed.
Rif (Berachos 18b): One who gives Shalom to his Rebbi causes the Shechinah to depart from Yisrael.
R. Yonah (DH veha'Nosen): This connotes that the Talmid greets the Rebbi first. This is improper. He should unable to speak up first due to his great awe, like Moshe was unable to greet Hash-m. The Gemara often mentions the time to give Shalom to one's Rebbi. It means, the time to return Shalom.
Note: Our texts say that also returning Shalom causes the Shechinah to depart.
Rambam (Hilchos Talmud Torah 5:5): One does not give Shalom to his Rebbi or answer like we do to friends. Rather, he bows and says with awe and honor 'Shalom Alecha Rebbi'. If hie Rebbi gave Shalom to him, he answers 'Shalom Alecha Rebbi v'Mori'.
Rashi (Berachos 54a DH she'Yehei): It does not disgrace Hash-m to greet people with His name. We learn from Boaz and the angel that greeted Gid'on.
Rashi (i.e. Rivan, Makos 23b DH v'She'alas): They enacted to permit greeting people with Hash-m's name; it is not considered saying His name in vain. Alternatively, one is obligated to do so. We fulfill this by greeting with 'Shalom', for this is one of His names - "Va'Yikra Lo Hash-m Shalom l'Shem Hash-m".
Note: I heard from Rav Moshe Shapiro, Shlita that 'Good Shabbos' fulfills the enactment, for also 'Shabbos' is a name of Hash-m.
Aruch (Erech Es): One might have thought that the enactment was only in the old days when Yisrael were sovereign. "V'Al Tavuz Ki Zoknah Imecha" teaches that it is obligatory even nowadays.
Rambam (Hilchos De'os 5:7): A Chacham greets other people first with Shalom, in order that people will be pleased with him.
Source (Kesef Mishneh): He learns from Avos 4:15.
Note: Perhaps he also learns from R. Yochanan ben Zakai. He always gave Shalom first, even to a Nochri in the market (Berachos 17a).
Einayim l'Mishpat (Berachos 54a DH v'Hiskinu): The Rambam holds that greeting with 'Shalom' fulfills the enactment. The Rambam does not teach that others (not Chachamim) must greet with Hash-m's name because he holds that the enactment was merely to permit doing so (Perush ha'Mishnayos Sof Berachos).
Rosh (Berachos 4:5): Rashi says that the Isur is to give Shalom to one's Rebbi like he does to others, without saying 'Rebbi'. The Yerushalmi says that a smaller Chacham does not greet a bigger Chacham at all, to fulfill "Ra'uni Ne'arim v'Nechba'u". However, it seems that the Bavli argues, for it says that Toch Kedai Dibur is the time to give Shalom to one's Rebbi (Bava Kama 73b).
Rebuttal (second answer in Tosfos Berachos 27b DH veha'Nosen): Only a Talmid Chaver may give Shalom to his Rebbi. (Tosfos Yevamos 57b DH Omar says that this is a Chacham who can reason by himself, but he needs to hear teachings from his Rebbi. Rashi (Eruvin 63a DH Talmid) says that he is a Chacham like the Rebbi, just he learned from him one or more things.
Defense (Gra YD 242:39): In the Yerushalmi, R. Yochanan complained that Benei Bavel do not give Shalom to him. R. Yakov bar Idi explained that they hold that a smaller Chacham does not greet a bigger Chacham, to fulfill "Ra'uni Ne'arim v'Nechba'u". The Rosh learns from the Shi'ur of Toch Kedai Dibur that the Bavli argues. R. Yonah says that the Beraisa forbids giving Shalom, but permits returning Shalom. It is difficult to say that R. Yochanan did not know the Beraisa. Also, why didn't R. Yakov bar Idi answer that they hold like the Beraisa! Rather, the Bavli argues, like the Rosh says.
Question: In Shabbos (89a) it says that a slave does not give Shalom to his master!
Answer #1 (Tosfos Bava Kama 73b DH Kedei): A slave is different than a Talmid. A slave fears his master, therefore he should never give Shalom.
Answer #2 (Maharsha Shabbos 89a DH v'Omar): A host inquires about the wellbeing of his guest. This is She'alas Shalom. Giving Shalom is when a guest greets a host. A Talmid may be Sho'el Shalom, but he does not give Shalom to his Rebbi.
Me'iri (Berachos 63a Sof DH ha'Mishnah): Even though one might say that greeting with Hash-m's name is Shem Shamayim l'Vatalah and the way of commoners, in was enacted to do so to make His name fluent among people.
Shulchan Aruch (YD 242:16): One does not give Shalom to his Rebbi like he does to others. Rather, he bows and says with awe and honor 'Shalom Alecha Rebbi'. If his Rebbi gave Shalom to him, he answers 'Shalom Alecha Mori v'Rebbi'.
Source (Gra 38): We learn from Sanhedrin 98a. This needs investigation (R. Yehoshua ben Levi greeted Mashi'ach by saying 'Shalom Alecha Rebbi v'Mori'. Perhaps we must show as much honor when returning Shalom to his Rebbi as one shows to Mashi'ach wen greeting him.)
Taz (5) and Shach (25): It should say '...Rebbi v'Mori', like it says in the Tur, Rambam and old texts of the Shulchan Aruch. It is normal to add when returning Shalom.
Rema: This is the custom. Some say that a Talmid does not give Shalom at all - "Ra'uni Ne'arim v'Nechba'u".
Shulchan Aruch (OC 110:4): One who travels should say 'may it be Your will...to bring us l'Shalom...'
Magen Avraham (9): When a person leaves, we do not say 'go b'Shalom', rather, l'Shalom.
Shulchan Aruch (219:4): If Reuven was saved from danger and Shimon said 'Baruch Atah Hash-m Elokeinu Melech ha'Olam that bestowed all good upon you' or 'Baruch Rachmana (the Merciful One) Malka d'Alma (King of the world), Who gave you to us', and Reuven answered 'Amen', he was Yotzei (Birkas ha'Gomel).
Rema: This is not a Berachah l'Vatalah for Shimon, even though he is not obligated, since he blesses just to praise and thank Hash-m for his Chesed to Reuven, in which Shimon rejoices.
Taz (3): This is only for a relative or dear friend, e.g. a father or Rebbi, for whom one feels a great Simchah. If one does not feel a great Simchah, but merely says so for the sake of Shalom, he should say 'Baruch Rachmana Who gave...' He should not say a real Berachah with Shem and Malchus, for that would be l'Vatalah.
Rebuttal (Mishbetzos Zahav 3): Rachmana is also a name of Hash-m. One is Yotzei Birkas ha'Motzi if he said 'Baruch Rachmana the King, the Owner of this bread', he was Yotzei (Shulchan Aruch 167:10). If one may say Rachmana when he is not obligated, why are we lenient about Safek Berachos? We should say them in Arame'ic! Perhaps it is forbidden only when he says Malka d'Alma', which shows that he refers to Hash-m.
Defense (Sha'ar ha'Tziyon 15): Even without Simchah one may bless another with Hash-m's name for the sake of Shalom, all the more so 'Baruch Rachmana' is permitted! (The Mishnah Berurah (18) is stringent like the Mishbetzos Zahav to say literally 'Baruch ha'Shem Yisbarach...' without Shem and Malchus.)