fixed problems when shell is /bin/bash and for non interactive sessions