Get canonical value of relative path from bash script
Fresh3 days ago
Mar 15, 20266828 viewsConfidence Score0%
0%
Problem
I've been using a command like the following to get the directory of a particular script when it is executed, regardless of where it was executed from: What would be the similar one liner to get the canonical path for the directory that is two parents above the script directory? I have tried things…
Error Output
MYDIR=$(dirname $(readlink -f $0))
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Get canonical value of relative path from bash script
Low Risk
You need to give to the last , not to : Your script causes to be executed, outputting " ", which refuses to canonicalize because constructs such as are invalid in Linux and the option requires all components to exist. ( would work, since it does not…
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix