yes - macOS


yes infinitely outputs a single word or phrase to stdout, primarily used for confirming prompts or supplying continuous input. It effectively automates repetitive yes responses in scripts or command chains.


yes [STRING]




  • Infinitely output “Yes”:
  • Output “Hello” 20 times:
yes "Hello" | head -n 20
  • Automatically confirm a script’s prompt: | yes

Common Issues

  • Accidental Execution: Ensure you intend to execute yes as it can potentially cause unintended consequences by automatically confirming prompts.


  • Bash Scripting: Use yes to automate user input within bash scripts, ensuring a consistent flow without requiring manual confirmation.
  • Continuous Input: Combine yes with other commands to provide an endless stream of input, such as testing programs that expect user responses.
  • echo: Echoes a string to stdout
  • head: Outputs the first n lines of input
  • tail: Outputs the last n lines of input
  • more: Interactively displays output, allowing page-by-page navigation