This is how your imaginary function may look materialized:
abs () {
local _PWD _BN
[ -d "${1}" ] && _PWD="${1}"
[ -f "${1}" ] && { _PWD=$(dirname "${1}") ; _BN=/$(basename "${1}") ;}
pushd $_PWD >/dev/null
echo $(pwd)${_BN}
popd >/dev/null
}
You can pass either file or directory path as parameter. it then will go to the specified path and print out working directory then that is what you want. You may want to add some validations around against empty parameter, non-existing path or insufficient permissions etc. according to your specific needs - I ommitted that from this example.
the `pushd/popd` pair performs the jump to the target and back
`>/dev/null` prevents these commands from printing out directory stack what they by default do and that would spoil the desired output