1

Why does the following line break the terminal when executed in a non-interactive shell, but doesn't have the same effect when executed in an interactive shell?

for i in {1..10}; do sudo -u testuser echo & done ;wait
New contributor
Georgii is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • Do you usually have to enter a password to use sudo, or have you set up passwordless access to it for your user account? Commented 7 hours ago

1 Answer 1

2

Because the authors of sudo take special precautions to ensure that it sends prompts to, and receives input from, an actual interactive terminal.

This is sudo functioning as designed.

For more information, read man sudo sudoers.

For even more information, you can download, and read, the source.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.