11

Is there a Linux command similar to yes but one that outputs newlines? Something like

$ yes enter

That outputs

\n\n\n\n\n\n

Similar too how yes 'foo' outputs

foo
foo
foo
Evan Carroll
  • 30,763
  • 48
  • 183
  • 315
Jimbo
  • 131

2 Answers2

15

Similar to what was mentioned in the comments, this will do it:

yes '<enter>'

Will output the literal string <enter>, or you can use '' for newlines.

yes ''
Evan Carroll
  • 30,763
  • 48
  • 183
  • 315
4

Well, if yes '' wasn't good enough (and it is) but you just wanted to show off by being more esoteric you could always do

tr \\000 \\n < /dev/zero
infixed
  • 887