3 Improved by 9 bytes
source | link

sed, 116 9292 83 bytes

:l
/^9*$/s/^/0/
s/.9*$/_&/
h
s/.*\([^9]9*\)$*_/\1/
y/0123456789/1234567890/
x
s/[^9]9*$_.*//
G
s/\n//
 p
b l

Usage: Sed operates on text input and it needs input do anything. To run the script, feed it with just one empty line:

$ echo | sed -f forever.sed

Explanation: To increment a number, the current number is split up into a prefix and a suffix where the suffix is of the form [^9]9*. Each digit in the suffix is then incremented individually, and the two parts are glued back together. If the current number consists of 9 digits only, a 0 digit is appended, which will immediately incremented to a 1.

sed, 116 92 bytes

:l
/^9*$/s/^/0/
h
s/.*\([^9]9*\)$/\1/
y/0123456789/1234567890/
x
s/[^9]9*$//
G
s/\n//
 p
b l

Usage: Sed operates on text input and it needs input do anything. To run the script, feed it with just one empty line:

$ echo | sed -f forever.sed

Explanation: To increment a number, the current number is split up into a prefix and a suffix where the suffix is of the form [^9]9*. Each digit in the suffix is then incremented individually, and the two parts are glued back together. If the current number consists of 9 digits only, a 0 digit is appended, which will immediately incremented to a 1.

sed, 116 92 83 bytes

:
/^9*$/s/^/0/
s/.9*$/_&/
h
s/.*_//
y/0123456789/1234567890/
x
s/_.*//
G
s/\n//p
b

Usage: Sed operates on text input and it needs input do anything. To run the script, feed it with just one empty line:

$ echo | sed -f forever.sed

Explanation: To increment a number, the current number is split up into a prefix and a suffix where the suffix is of the form [^9]9*. Each digit in the suffix is then incremented individually, and the two parts are glued back together. If the current number consists of 9 digits only, a 0 digit is appended, which will immediately incremented to a 1.

2 Better solution
source | link

sed, 116116 92 bytes

a _
:l
s/^_/1/
s/9_/_0/
s/8_/9^9*$/
 s/7_^/80/
s/6_/7/h
s/5_.*\([^9]9*\)$/6\1/
sy/4_0123456789/51234567890/
s/3_/4/x
s/2_[^9]9*$/3/
s/1_/2/G
s/0_/1/
 \n/_/b l
p
s/$/_/
b l

SedUsage: 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

Explanation: To increment a number, the current number is split up into a prefix and a suffix where the suffix is of the form [^9]9*. Each digit in the suffix is then incremented individually, and the two parts are glued back together. If the current number consists of 9 digits only, a 0 digit is appended, which will immediately incremented to a 1.

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

sed, 116 92 bytes

:l
/^9*$/s/^/0/
h
s/.*\([^9]9*\)$/\1/
y/0123456789/1234567890/
x
s/[^9]9*$//
G
s/\n//
p
b l

Usage: Sed operates on text input and it needs input do anything. To run the script, feed it with just one empty line:

$ echo | sed -f forever.sed

Explanation: To increment a number, the current number is split up into a prefix and a suffix where the suffix is of the form [^9]9*. Each digit in the suffix is then incremented individually, and the two parts are glued back together. If the current number consists of 9 digits only, a 0 digit is appended, which will immediately incremented to a 1.

1
source | link

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