Find absolute path of Bash script

/ Published in: Bash
Save to your folder(s)

Gets the absolute path of the script itself even when it's executing, not just a simple "pwd".

Copy this code and paste it in your HTML
  1. abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.