# Bash 4.2 + grep + sed, 68 / 7! = 0.013492

<!-- language-all: lang-bash -->

 t=(grep / 0 0 sed)
 ${t[$1<3?0:$1%5]} -P "5{$1,1}"<<<$[2**($1%73)%-1]

Supports exit codes **0**, **1**, **2**, **4**, **126**, **127**, and **136**.

TIO's bash is too new. Currently working on a permalink.

### Verification

 for n in 0 1 2 4 126 127 136; do bash exit.sh $n; echo $? >&0; done &> /dev/null
 0
 1
 2
 4
 126
 127
 136

### How it works (incomplete)

*grep* will exit successfully (exit code **0**) if it can find at least one match, fail (exit code **1**) if there are no matches, and exit with **2** if there are any syntax errors.

* For input **0**, the pattern `$1{$1,1}` becomes `0{0,1}`, which matches zero or one zeroes, so *grep* exits with **0**.

* For input **1**, the pattern becomes `1{1,1}`, which fails with exit code **1** since there are no matches on STDIN.

* For input **2**, the pattern becomes `2{2,1}`, which fails with exit code **2** since the limits are out of order.

[Bash]: https://www.gnu.org/software/bash/
[Try it online!]: https://tio.run/nexus/bash#S04sUbBTKEnNLVCwsVFQd/V3U/@fXpRaoKAboKCkYlitYqhjWKtkY2Nj8B8ox5WUWJwBUW0A1Kafklqmn1eak8OVmpyRr6BijyRvSEDeCJv8fwA "Bash – TIO Nexus"