It is stated in Shabbat (10a): One who enters a bathhouse, a place where people stand dressed – there is reading of Scripture and prayer there, and it goes without saying the greeting of "Shalom." And he puts on tefillin, and it goes without saying that he does not remove them. A place where people stand naked and dressed – there is greeting of "Shalom" there, but there is no reading of Scripture or prayer, and he does not remove tefillin, but he does not put them on initially. A place where people stand naked – there is no greeting of "Shalom" there, and it goes without saying no reading of Scripture or prayer, and he removes tefillin, and it goes without saying that he does not put them on. See there. For they had three rooms in the bathhouse: the innermost where they bathe, the middle where they dress and undress, and the outermost where, after they have dressed, they sit there to rest a little. Therefore, the middle room is partially judged like a bathhouse, and partially not like a bathhouse. And the outermost is entirely not like a bathhouse, even though it is called by the name of the bathhouse. And the innermost is judged like a beit hakisse. And the greeting of "Shalom" is with the Name. And there are those who are meticulous when calling a man whose name is "Shalom" not to call him by his name in the bathhouse, because "Shalom" is the name of the Holy One, Blessed be He, as we say there. But in a foreign language such as "Salam" and the like – it is permitted (Magen Avraham and Bach). And there are those who permit it entirely, since he only intends the name of the man (Taz). And it is simple that also in filthy alleys – it is forbidden to give a greeting of "Shalom."
איתא בשבת (י א): הנכנס לבית המרחץ, מקום שבני אדם עומדין לבושין – יש שם מקרא ותפילה, ואין צריך לומר שאילת שלום. ומניח תפילין, ואין צריך לומר שאינו חולץ. מקום שבני אדם עומדים ערומים ולבושים – יש שם שאילת שלום, ואין שם מקרא ותפילה, ואינו חולץ תפילין, ואינו מניח לכתחילה. מקום שבני אדם עומדים ערומים – אין שם שאילת שלום, ואין צריך לומר מקרא ותפילה, וחולץ תפילין, ואין צריך לומר שאינו מניחן. עיין שם. דשלושה בתים היה להם במרחץ: הפנימית שרוחצין שם, והאמצעית שלובשין ופושטין שם, והחיצונה שאחר שלבשו ישבו שמה לנוח מעט. ולכן האמצעי מקצתו דינו כמרחץ, ומקצתו דלא כמרחץ. והחיצונה לגמרי דלא כמרחץ, אף שנקראת על שם המרחץ. והפנימית דינה כבית הכסא. ושאילת שלום הוי בשם. ויש מקפידין לקרוא איש ששמו "שלום" לבלי לקרות אותו בשמו במרחץ, משום ד"שלום" הוי שמו של הקדוש ברוך הוא כדאמרינן שם. אבל בלשון לעז כגון "סאלאם" וכיוצא בו – מותר (מגן אברהם וב"ח). ויש מתירין לגמרי, כיון דאינו מכוין אלא רק לשמו של האיש (ט"ז). ופשוט הוא דגם במבואות המטונפות – אסור ליתן שלום.