Q. Is it permitted to shake hands with an ovel during shiva, without saying Shalom or greetings? How about before davening?
A. Many Poskim permit wishing long life, giving a hand or blessing as signs of comforting and consolation, as this is seen as being different to greeting and saying Sholom, which is prohibited to an ovel. (Har Tzvi Y.D. 290 - Nishmas Isroel 20,1). Yavia Omer (Y.D. 35,10) mentions that shaking the ovel's hand was tradition in the Egyptian communities. However Horav Shlomo Miller's Shlit"a opinion is that in our communities, this may be interpreted more as a greeting than a demonstration of solace, and should therefore be avoided.
Many Poskim also permit shaking someone's hand when necessary before davening, especially if it is done with the intention of avoiding saying Sholom. (Avnei Yashfa 3,5). Horav Shlomo Mileer Shlit"a agrees.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit"a