[bug] yes in terminal equals endless y

I do not have a Microsoft Account, and so I do not have a GitHub account, and that is not going to change. But if you open your terminal and types yes and press enter, you will have an endless stream of y entered on your behalf. You will need to press control and c to end this.

3 Likes

This is not a bug. This is, in fact, the sole purpose of the yes command.

5 Likes

yes      

5 Likes

You can try yes This is not a bug.

Seriously?

Why is there no, “no” command?

You can type alias no='yes n' and then you have a no command.

1 Like

Every once in a while, I stumble upon something that makes no sense to me … but ok.

:rofl:

2 Likes
❯ touch foo

~                                                                                                                                                        ben@lamorna 
❯ chmod a-w foo

~                                                                                                                                                        ben@lamorna 
❯ rm foo
rm: remove write-protected regular empty file 'foo'? n

~                                                                                                                                                        ben@lamorna 
❯ yes | rm foo
1 Like

There are so many operating systems, going back to the old dr-dos days, that this does not happen. So many Linux distros, where this does not seem to be an issue.

Just, NixOS. Only NixOS.

As I said… I don’t understand it, but, ok.

The idea of the yes command is that there are some programs that just ask for a bunch of things to be confirmed by entering y to its prompt. So you can just pipe the yes output into it.

yes | command_that_prompts

The command also accepts an argument for the string it should output, so that you can change what you’re responding with.

In practice this is rarely relevant since commands that prompt for confirmation will generally have their own command line flag for automatically confirming things

1 Like

The code I just posted to you was composed on MacOS.

What? What “issue” are you even talking about? The yes command is installed by default on basically every Linux distro, not just NixOS. This isn’t an “issue”, it’s normal and near-ubiquitous Linux expectation.

4 Likes

If I open an Apple macOS terminal and type yes, press enter, it does not endlessly fill my screen with an endless “y”

Mine does :man_shrugging: I guess yours is special.

Not so much an issue, exactly, just really odd behavior (unexpected).

I have no fight in this. If this is how NixOS does thing - OK.

Just not, what I would expect.

But why would you claim this when, as far as I can tell, just about every single Linux distro includes the yes command?

Maybe we’re not understanding each other. Saying “yes” (or no) is not an issue.

Saying yes 1x and with endless “Y” in reply is not what I would expect.

That doesn’t answer my question. Why would you claim that is not the case on other Linux distros, when it seems to be ubiquitous behavior? What distros did you try that did not do this?

Last I checked, all of them. Your pick.

Fedora, Ubuntu, Arch Linux, openSUSE.

Unless there has been an update to the ecosystem, and I am completely out of the loop, this (see screenshot) is not how it works.

YES(1)                                     User Commands                                     YES(1)

NAME
       yes - output a string repeatedly until killed

SYNOPSIS
       yes [STRING]...
       yes OPTION

DESCRIPTION
       Repeatedly output a line with all specified STRING(s), or 'y'.

       --help display this help and exit

       --version
              output version information and exit

AUTHOR
       Written by David MacKenzie.

REPORTING BUGS
       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
       Report any translation bugs to <https://translationproject.org/team/>

SEE ALSO
       Full documentation <https://www.gnu.org/software/coreutils/yes>
       or available locally via: info '(coreutils) yes invocation'

       Packaged by https://nixos.org
       Copyright © 2025 Free Software Foundation, Inc.
       License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
       This is free software: you are free to change and redistribute it.
       There is NO WARRANTY, to the extent permitted by law.

GNU coreutils 9.6                           January 2025                                     YES(1)

You may now correct your expectations.

3 Likes