You can use get_blog_details()
to do it.
Use it the following way:–
function greeting() {
global $blog_id;
$current_blog = get_blog_details( $blog_id );
if ( 'one' == $current_blog->blogname ) {
echo 'hello';
} elseif ( 'two' == $current_blog->blogname ) {
echo 'goodbye';
}
}