Hacker News new | ask | show | jobs
by Yasuraka 641 days ago
I've been using

script_dir="$(dirname "$(realpath "$0")")"

Hasn't failed me so far and it's easy enough to remember

1 comments

Read the answers and comments from the SO threads. It won't always work for other people in other context.