Question: Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713).

The Task
--------

Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`.

Restrictions
------------

* You may not call anything which is intended directly for exit code output (`System.exit(x)`, returning from `main`, etc.). Instead, your program must cause an error or crash which will cause, with a probability of 1, the program to exit with the input integer.
	+ In this case, the words "error" and "crash" means that the program caused some fatal unintended exception, wherein a method, operation or otherwise was used incorrectly that caused an irreversible failure.
	+ You may not directly cause the error by throwing it directly. You must cause it by using a method, function, or otherwise whose purpose serves a different function (i.e. attempting to execute a file write to a read-only directory).
* You must have at least two exit codes accounted for in your program.
* Termination of the process with the use of signals is banned. (Reasoning may be found [in this discussion](http://chat.stackexchange.com/transcript/message/34843663#34843663))

Scoring
-------

Your program's score is determined by the number of supported exit codes, where code concision is tiebreaker. The greatest number of supported exit codes wins!

Answer: 
Unix Shell (+ncurses +BSD utilities), ~~36~~, 26 bytes, 256 exit codes
======================================================================

**Golfed**

```bash
jot -bu0 $[252+$1]|tput -S

```

> 
> If the -S option is used, tput checks for errors from each line, and if any errors are found, will set the exit code to 4 plus the number of lines with errors. If no errors are found, the exit code is 0. No indication of which line failed can be given so exit code 1 will never appear. Exit codes 2, 3, and 4 retain their usual interpretation.
> 
> 
> 

Once the *tput* exit code goes over 255, it just overflows, so 253 (errors on input) will result in the exit code of 1 e.t.c., thus yielding the desired exit status for the whole range of inputs.

*Note*: whether *tput* will fail on not, when setting/getting a particular capability, depends on the terminal type, I've used: `xterm with 256 colors`

[jot](https://www.freebsd.org/cgi/man.cgi?jot(1)) is a *BSD* utility, which
prints sequential or random data, and (AFAIK) is also available out of the box on OSX systems.

If your system does not have `jot` available, you can use a slightly longer (29 bytes) version:

```bash
yes u0|sed $[252+$1]q|tput -S

```

[Try It Online !](http://www.tutorialspoint.com/execute_bash_online.php?PID=0Bw_CjBb95KQMZ1RmQkN4TEpvMDQ) (the 29 bytes version)
C90 (gcc), 256 exit codes, ~~28~~ ~~27~~ 18 bytes
=================================================

```c
main(){getchar();}

```

I'm not sure if this is clever or cheaty, but I don't think it violates the rules as written: it technically doesn't use `exit`, `return`, or any error throwing mechanism, but simply relies on undefined behavior and the fact that gcc does something rather convenient as far as this challenge goes.

[Try it online!](https://tio.run/nexus/bash#TYyxDoIwGAb3PsU3YICBSkgYTFEnXX0BFvK3lA78NViTJsizoyZq3C6X3FEXcICJLpDXRhKaBunpck7XsXOc5bM1gYZuynK1rC8vLBGKW9B7y/ddicL/4r@LEL2fwHCMuZSyqutFQXtcJ8ehR9vGJPvwpqwiEs7xgNx@DwqGBo/k@K7YrE8 "Bash – TIO Nexus")

### How it works

This simply uses `getchar` to read one byte from STDIN. By itself, this does nothing.

However, a compliant C90 program must end with a `return` statement or something equivalent; everything else is undefined behavior. gcc ends the generated assembly with a `ret` anyway, so whatever value was casually in the register EAX will get returned by the program. Luckily, glibc's `getchar` stores the byte it reads from STDIN in EAX, so the value of that byte is the exit code of our program.