get_full_path() {
  target="$1"

  if [ -f "${target}" ]; then
    filename="${target##*/}"
    [ "${filename}" = "${target}" ] && \
        target="./${target}"
    target="${target%/*}"
    cd "${target}" || exit
    full_path="${PWD}/${filename}"
  elif [ -d "${target}" ]; then
    cd "${target}" || exit
    full_path="${PWD}"
  fi

  printf "%s" "${full_path%/}"
}
# get_full_path $(basename "$0")