WASHINGTON — President Trump has insisted that he is not going to compromise with Democrats to end the government shutdown, and that he is comfortable in his unbendable position. But privately, it’s sometimes a different story.

“We are getting crushed!” Mr. Trump told his acting chief of staff, Mick Mulvaney, after watching some recent coverage of the shutdown, according to one person familiar with the conversation. “Why can’t we get a deal?”

The president is confronted by a divided and partially shuttered government with an untested staff that has undergone yet another shake-up. Polls show that most Americans blame him for the government shutdown, and his advisers are warning him of its negative effects on the economy. And as the shutdown enters its 27th day on Thursday with no end in sight, most of his top aides would like him to find a way out.

Mr. Trump has told them he believes over time the country will not remember the shutdown, but it will remember that he staged a fight over his insistence that the southern border be protected. He wants Democrats to come back to the table agreeing with his position on a wall, and he does not understand why they have not.