Skip to content

Commit

Permalink
fix shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Sep 19, 2023
1 parent f9144ed commit b9df629
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/shellUtils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ get_abs_path() {
done

# Remove any trailing '/'
abs_path=$(echo "$abs_path" | sed 's:/*$::')
while [[ $abs_path == */ ]]; do
abs_path=${abs_path%/}
done

# Special case for root
[ -z "$abs_path" ] && abs_path="/"

# Special case to remove any starting '//' when the input path was absolute
abs_path=$(echo "$abs_path" | sed 's:^//:/:')
abs_path=${abs_path/#\/\//\/}

echo "$abs_path"
}
}

0 comments on commit b9df629

Please sign in to comment.