/ Published in: Bash

Gets the absolute path of the script itself even when it's executing, not just a simple "pwd".
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
Comments
