Skip to main content
1 of 3
matz
  • 181
  • 3

sed, 116 bytes

a _
:l
s/^_/1/
s/9_/_0/
s/8_/9/
s/7_/8/
s/6_/7/
s/5_/6/
s/4_/5/
s/3_/4/
s/2_/3/
s/1_/2/
s/0_/1/
/_/b l
p
s/$/_/
b l

Sed operates on text input and it needs input do anything. To run the script, feed it with just one empty line (assuming the script is in a file called forever.sed):

$ echo | sed -f forever.sed
matz
  • 181
  • 3