Skip to main content
added 8 characters in body
Source Link
user19214
user19214

bash builtins only - 21 bytes

The X file:

trap "echo $[++i]" 0;

EXIT –> 0
$((...)) -> $[...]
;-)

 

bash builtins only - 26 bytes

Straight forward while using only bash builtins.
IOW: No external helpers.

The X file:

trap "echo $((++i))" exit;

(No final newline.)

Proof of the pudding:

$ bash <(cat X)
1
$ bash <(cat X X)
2
$ bash <(cat X X X)
3

Concat with or without newline inbetween:

$ cat X X ; echo # added echo compensates missing \n only
trap "echo $((++i))" exit;trap "echo $((++i))" exit;
$ bash <(cat X X)
2
$ cat X <(echo) X ; echo
trap "echo $((++i))" exit;
trap "echo $((++i))" exit;
$ bash <(cat X <(echo) X)
2

bash builtins only - 21 bytes

The X file:

trap "echo $[++i]" 0;

EXIT –> 0
$((...)) -> $[...]
;-)

bash builtins only - 26 bytes

Straight forward while using only bash builtins.
IOW: No external helpers.

The X file:

trap "echo $((++i))" exit;

(No final newline.)

Proof of the pudding:

$ bash <(cat X)
1
$ bash <(cat X X)
2
$ bash <(cat X X X)
3

Concat with or without newline inbetween:

$ cat X X ; echo # added echo compensates missing \n only
trap "echo $((++i))" exit;trap "echo $((++i))" exit;
$ bash <(cat X X)
2
$ cat X <(echo) X ; echo
trap "echo $((++i))" exit;
trap "echo $((++i))" exit;
$ bash <(cat X <(echo) X)
2

bash builtins only - 21 bytes

The X file:

trap "echo $[++i]" 0;

EXIT –> 0
$((...)) -> $[...]
;-)

 

bash builtins only - 26 bytes

Straight forward while using only bash builtins.
IOW: No external helpers.

The X file:

trap "echo $((++i))" exit;

(No final newline.)

Proof of the pudding:

$ bash <(cat X)
1
$ bash <(cat X X)
2
$ bash <(cat X X X)
3

Concat with or without newline inbetween:

$ cat X X ; echo # added echo compensates missing \n only
trap "echo $((++i))" exit;trap "echo $((++i))" exit;
$ bash <(cat X X)
2
$ cat X <(echo) X ; echo
trap "echo $((++i))" exit;
trap "echo $((++i))" exit;
$ bash <(cat X <(echo) X)
2
I'm a summary virus! Please copy me to your summaries!
Source Link
user19214
user19214

bash builtins only - 21 bytes

The X file:

trap "echo $[++i]" 0;

EXIT –> 0
$((...)) -> $[...]
;-)

bash builtins only - 26 bytes

Straight forward while using only bash builtins.
IOW: No external helpers.

The X file:

trap "echo $((++i))" exit;

(No final newline.)

Proof of the pudding:

$ bash <(cat X)
1
$ bash <(cat X X)
2
$ bash <(cat X X X)
3

Concat with or without newline inbetween:

$ cat X X ; echo # added echo compensates missing \n only
trap "echo $((++i))" exit;trap "echo $((++i))" exit;
$ bash <(cat X X)
2
$ cat X <(echo) X ; echo
trap "echo $((++i))" exit;
trap "echo $((++i))" exit;
$ bash <(cat X <(echo) X)
2

Ok... and now meditating about trickier ones...

OmmmMMMmmmMMMmmm... ;-)

bash builtins only - 26 bytes

Straight forward while using only bash builtins.
IOW: No external helpers.

The X file:

trap "echo $((++i))" exit;

(No final newline.)

Proof of the pudding:

$ bash <(cat X)
1
$ bash <(cat X X)
2
$ bash <(cat X X X)
3

Concat with or without newline inbetween:

$ cat X X ; echo # added echo compensates missing \n only
trap "echo $((++i))" exit;trap "echo $((++i))" exit;
$ bash <(cat X X)
2
$ cat X <(echo) X ; echo
trap "echo $((++i))" exit;
trap "echo $((++i))" exit;
$ bash <(cat X <(echo) X)
2

Ok... and now meditating about trickier ones...

OmmmMMMmmmMMMmmm... ;-)

bash builtins only - 21 bytes

The X file:

trap "echo $[++i]" 0;

EXIT –> 0
$((...)) -> $[...]
;-)

bash builtins only - 26 bytes

Straight forward while using only bash builtins.
IOW: No external helpers.

The X file:

trap "echo $((++i))" exit;

(No final newline.)

Proof of the pudding:

$ bash <(cat X)
1
$ bash <(cat X X)
2
$ bash <(cat X X X)
3

Concat with or without newline inbetween:

$ cat X X ; echo # added echo compensates missing \n only
trap "echo $((++i))" exit;trap "echo $((++i))" exit;
$ bash <(cat X X)
2
$ cat X <(echo) X ; echo
trap "echo $((++i))" exit;
trap "echo $((++i))" exit;
$ bash <(cat X <(echo) X)
2
I'm a summary virus! Please copy me to your summaries!
Source Link
user19214
user19214

bash builtins only - 26 bytes

Straight forward while using only bash builtins.
IOW: No external helpers.

The X file:

trap "echo $((++i))" exit;

(No final newline.)

Proof of the pudding:

$ bash <(cat X)
1
$ bash <(cat X X)
2
$ bash <(cat X X X)
3

Concat with or without newline inbetween:

$ cat X X ; echo # added echo compensates missing \n only
trap "echo $((++i))" exit;trap "echo $((++i))" exit;
$ bash <(cat X X)
2
$ cat X <(echo) X ; echo
trap "echo $((++i))" exit;
trap "echo $((++i))" exit;
$ bash <(cat X <(echo) X)
2

Ok... and now meditating about trickier ones...

OmmmMMMmmmMMMmmm... ;-)

bash builtins only - 26 bytes

Straight forward while using only bash builtins.

The X file:

trap "echo $((++i))" exit;

(No final newline.)

Proof of the pudding:

$ bash <(cat X)
1
$ bash <(cat X X)
2
$ bash <(cat X X X)
3

Concat with or without newline inbetween:

$ cat X X ; echo # added echo compensates missing \n only
trap "echo $((++i))" exit;trap "echo $((++i))" exit;
$ bash <(cat X X)
2
$ cat X <(echo) X ; echo
trap "echo $((++i))" exit;
trap "echo $((++i))" exit;
$ bash <(cat X <(echo) X)
2

Ok... and now meditating about trickier ones...

OmmmMMMmmmMMMmmm... ;-)

bash builtins only - 26 bytes

Straight forward while using only bash builtins.
IOW: No external helpers.

The X file:

trap "echo $((++i))" exit;

(No final newline.)

Proof of the pudding:

$ bash <(cat X)
1
$ bash <(cat X X)
2
$ bash <(cat X X X)
3

Concat with or without newline inbetween:

$ cat X X ; echo # added echo compensates missing \n only
trap "echo $((++i))" exit;trap "echo $((++i))" exit;
$ bash <(cat X X)
2
$ cat X <(echo) X ; echo
trap "echo $((++i))" exit;
trap "echo $((++i))" exit;
$ bash <(cat X <(echo) X)
2

Ok... and now meditating about trickier ones...

OmmmMMMmmmMMMmmm... ;-)

I'm a summary virus! Please copy me to your summaries!
Source Link
user19214
user19214
Loading
I'm a summary virus! Please copy me to your summaries!
Source Link
user19214
user19214
Loading
Source Link
user19214
user19214
Loading