UPDATE Once again, I can't post an answer to my question! Clicking the button just triggers an error message: "Unable to load popup - please try again". So, I have no other choice than to share the solution like this:
input_path="`token="0"; if [[ "$input_path" =~ /$ ]]; then token="1"; input_path="${input_path%/}"; fi; cd "${input_path%/*}"; printf "$PWD/"; if [[ "$token" -eq 1 ]]; then printf "${input_path##*/}/"; else printf "${input_path##*/}"; fi`"
Evaluation:
0:1 - bash exhaustion:unix philosophy
If coding thoroughly is an ambition, the bash exhaustion way just proves that in this case it's far better to rely on unix philosophy, here meaning application of tool realpath, instead of replicating what it does with bash - you see, it works, but it's a mess, very complicated and a lot more code.
Use the tool find, from a certain working directory, setting the scope with a relative path, search for any files, and apply -exec realpath - will have the same working directory as find, unless using -execdir - on the resulting matches - relative paths - and output will be that same list of relative paths, but transformed into absolute paths.
Out of curiosity: Can bash do this alone?