For the questions about `yes` command which outputs a string repeatedly until killed
Questions tagged [yes]
12 questions
64
votes
3 answers
How does `yes` write to file so quickly?
Let me give an example:
$ timeout 1 yes "GNU" > file1
$ wc -l file1
11504640 file1
$ for ((sec0=`date +%S`;sec<=$(($sec0+5));sec=`date +%S`)); do echo "GNU" >> file2; done
$ wc -l file2
1953 file2
Here you can see that the command yes writes…
Pandya
- 23,898
- 29
- 92
- 144
53
votes
5 answers
What is the point of the "yes" command?
There is a yes command in unix/linux which basically infinitely prints y to the stdout. What is the point of it, and how is it useful?
Cemre
- 657
- 1
- 5
- 6
28
votes
2 answers
Why does "yes&" crash my Bash session?
"Yes, and..." is a wonderful rule-of-thumb in improvisational comedy. Not so much in the UNIX world.
When I run the admittedly silly yes& command, I cannot interrupt it. The terminal crashes or gets stuck into a loop.
I expect the yes process to be…
Sebastian Carlos
- 146
- 2
- 12
18
votes
1 answer
What happens when writing gigabytes of data to a pipe?
Let's say I have a makefile with a recipe called hour_long_recipe, which as its name suggests takes an hour to run. At random points throughout the recipe it asks yes/no questions. Let's say it asks 10 questions in total.
One possible (and often…
NeatNit
- 291
- 2
- 6
9
votes
1 answer
How to pipe a 'yes' or 'y' into a program while invoked with 'sudo' in bash?
How to pipe a Y or yes to a program while invoking with sudo?
We can type like this
yes | command
yes | yum update
How to pipe the y from yes into a program via sudo like the following?
yes| sudo command
The y from yes is be passed into command…
Abhik Bose
- 2,090
- 2
- 15
- 30
3
votes
1 answer
Can you rescue a shell from an accidental "yes" command?
Scenario: I'm running a bunch of commands, some of which prompt for "yes/no" answers. I accidentally type yes as a command instead of as a response to a prompt. OOPS. Now my shell looks like this:
$ yum install -y something-important
... useful…
Indigenuity
- 133
- 3
3
votes
1 answer
yes | apt-get install --fix-broken
I am trying to write a non-interactive system update script.
Question:
if the following works well:
yes | dpkg --configure -a
will the following work also very well?:
yes | apt-get install --fix-broken
Vlastimil Burián
- 27,586
- 56
- 179
- 309
3
votes
2 answers
How to use `yes` with `xargs -p`?
Let's say I have ls | xargs -n1 -p rm, how do I use yes or yes n to automatically answer the questions generated by the -p flag?
I tried yes n | (ls | xargs -n1 -p rm) but didn't work.
UPDATE: The question is not really about rm, it's about how to…
Gabriel
- 139
- 4
1
vote
1 answer
If /dev/random is implemented as a pseudo-device, why isn't "yes"?
yes produces a stream of "y" chars, or other requested.
If Unixen have a pseudodevice for random numbers, why not useful streams like this too?
interstar
- 1,027
- 3
- 14
- 27
1
vote
1 answer
How to exit out of a 'yes' loop
Using the command yes you can make a loop in the Linux terminal.
How do you exit out of said loop?
(I tried Ctrl+C but it didn't work).
John D
- 121
- 1
- 2
- 6
0
votes
0 answers
Inquirer program answer questions by piping
Hi I have written this program with inquirer.js it has a list question and after that a text input.
I want to answer both questions with piping.
If I just keep the list question, I can easily use yes 1 | command and it selects the first option and…
Steve Moretz
- 101
- 2
0
votes
1 answer
What happens when piping the `yes` to another command?
If the yes command echos "y" continuously until killed, then it will never get done right?
If it will never get done then how does it pipe it's output to the next command??
yaquawa
- 111
- 3