NVidia Fan Speed Revisited

One of the comments to my last post about
adjusting the fan speed on your NVidia graphics card was that what
was needed was a script to adjust the speed based on the temperature.
The script presented here does just that.

The script takes a single argument, the desired temperature (default is 50C).
It then calculates a low and high temperature based on this and increases
the fan speed if the temperature gets above the max or decreases it if
the temperature gets below the minimum.

It determines the temperature and fan speed by parsing the output
of the nvclock command.
Without further ado, here is the script: