Direct numerical simulations (DNS) of temporally evolving shear layers have been performed to study the entrainment of irrotational flow into the turbulent region across the turbulent/non-turbulent interface (TNTI). Four cases with convective Mach number from 0.2 to 1.8 are used. Entrainment is studied via two mechanisms; nibbling, considered as vorticity diffusion across the TNTI, and engulfment, the drawing of the pockets of the outside irrotational fluid into the turbulent region. The mass flow rate due to nibbling is calculated as the product of the entrained mass flux with the surface area of the TNTI. It is found that increasing the convective Mach number results in a decrease of the average entrained mass flux and the surface area of the TNTI. For the incompressible shear layer the local entrained mass flux is shown to be highly correlated with the viscous terms. However, as the convective Mach number increases, the mass fluxes due to the baroclinic and the dilatation terms play a more important role in the local entrainment process. It is observed that the entrained mass flux is dependent on the local dilatation and geometrical shape of the TNTI. For a compressible shear layer, most of the entrainment of the irrotational flow into the turbulent region due to nibbling is associated with the compressed regions on the TNTI. As the convective Mach number increases, the percentage of the compressed regions on the TNTI decreases, resulting in a reduction of the average entrained mass flux. It is also shown that the local shape of the interface, looking from the turbulent region, is dominated by concave shaped surfaces with radii of curvature of the order of the Taylor length scale. The average entrained mass flux is found to be larger on highly curved concave shaped surfaces regardless of the level of dilatation. The mass fluxes due to vortex stretching, baroclinic torque and the shear stress/density gradient terms are weak functions of the local curvatures on the TNTI, whereas the mass fluxes due to dilatation and viscous diffusion plus the viscous dissipation terms have a stronger dependency on the local curvatures. As the convective Mach number increases, the probability of finding highly curved concave shaped surfaces on the TNTI decreases, whereas the probability of finding flatter concave and convex shaped surfaces increases. This results in a decrease of the average entrained mass flux across the TNTI. Similar to the previous works on jets, the results show that the contribution of the engulfment to the total entrainment is small for both incompressible and compressible mixing layers. It is also shown that increasing the convective Mach number decreases the velocities associated with the entrainment, i.e. induced velocity, boundary entrainment velocity and local entrainment velocity.