Learner Learner - 6 months ago 47
Linux Question

No equivalent of Yes

command in linux prints
infinitely on the console. This is helpful to respond to few interactive commands with
. For e.g.
yes | cp A/*.txt B
automatically overwrites all files in destination directory.

Is there an equivalent command in linux that prints

Answer Source

yes accepts an argument, y is just the default value.

You can use:

yes n | command

How cool is that?

Pro tip:

# Use this and see what happens
yes maybe | command

Note: Not every command implements maybe.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download