Replaced version comparison function

Fix for OSX error message:

    expr: not a decimal number: '1'
Fixed code formatting and removed dead code.

Fixed code formatting on version_compare function to match rest of file.

Removed old version_compare_old function as it is no longer needed.
Readlink and realpath doesn’t exists and/or has different argument flags

In OSX readlink has different arguments and realpath doesn’t exists.
These commands where being used to determine the absolute physical path
of a file. It is not necessary to use these commands to do this. Instead
a abs_path function has been created that uses pwd, basename and
dirname.
Switched to err method