yesx
Output a string repeatedly until killed.
Mirrors GNU yes. Run it as yesx, or as gnux yesx.
Synopsis
yesx [STRING]...GNU reference
Description
yesx repeatedly writes a line made of every STRING joined by single spaces, or 'y' when none is given, until it is killed or its output is closed. Output is written in large batches of whole lines, so it is fast enough to use as a data source. When the reader goes away (as in yesx | head) yesx stops quietly; any other write failure is reported and exits with status 1. A first '--' is taken as the end of options and not printed; --help and --version are honored only when they are the sole argument, and every other argument is repeated as text.
Permissions
Needs no filesystem permissions; it only writes to standard output.
Use cases
- Answering every prompt of an interactive command automatically.
- Generating an endless or, with head, a fixed amount of filler input.
- Loading a CPU core or a pipe for a quick throughput
test. - Declining every prompt with '
yesxn' to see what a command would ask. - Creating a
testfile of an exact size withheadx -c. - Producing numbered or repeated sample rows for testing other tools.
Flags
--help display this help and exit
--version output version information and exitExamples
Answer 'y' to every prompt of a command
yesx | rmx -i *.tmpAnswer 'n' instead
yesx n | rmx -i *.tmpConfirm every step of an interactive recursive removal
yesx | rmx -ri buildProduce five copies of a line
yesx 'all work and no play' | headx -n 5Join several arguments into one repeated line
yesx a b c | headx -n 2Repeat text that starts with a dash after --
yesx -- -n | headx -n 2Create a file of exactly one mebibyte
yesx 0123456789 | headx -c 1M > filler.txt && wcx -c filler.txtNumber a few repeated rows
yesx row | headx -n 4 | catx -nMeasure pipe throughput by counting 100 MiB
yesx | headx -c 100M | wcx -cStop cleanly inside a gnux shell pipeline
gnux shell -c 'yesx hello | headx -n 3 > out.txt; wcx -l out.txt'Exit status
| Status | Meaning |
|---|---|
| 0 | the reader went away (a closed pipe is the normal way yesx ends) |
| 1 | a write error other than a closed pipe |
Help in the terminal
yesx --help # options, first examples, exit status
gnux help yesx # this page: the full manual
gnux help yesx --OPTION # one option in depth, with its examples