This post is a compilation of the function getabspath() for different shells that can be used to get the absolute form of a path. The function accepts an argument path then returns the absolute form of it to the variable $__.
Bash
Code:
function getabspath {
local t=() i=0 IFS=/
case $1 in
/*)
__=${1#/}
;;
*)
__=${PWD#/}/$1
;;
esac
case $- in
*f*)
set -- $__
...