Skip to content

Commit

Permalink
Fix readlink_f of relative dir
Browse files Browse the repository at this point in the history
Previously `readlink_f example` would result in
`path/to/example/example`, duplicating the the relative directory.
  • Loading branch information
OJFord committed Nov 5, 2022
1 parent 23aea38 commit 7df205d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readlink_f() {
local file_name;

while [ "${target_file}" != "" ]; do
cd "${target_file%/*}" || early_death "Failed to 'cd \$(${target_file%/*})'";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(${target_file%/*})'";
file_name="${target_file##*/}" || early_death "Failed to '\"${target_file##*/}\"'";
target_file="$(readlink "${file_name}")";
done;
Expand Down

0 comments on commit 7df205d

Please sign in to comment.