mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 03:32:27 +01:00
fixup! Fix abs_dirname
This commit is contained in:
parent
87ae363144
commit
ff3b8d0115
15
install.sh
15
install.sh
|
@ -8,18 +8,17 @@ resolve_link() {
|
|||
abs_dirname() {
|
||||
local path="$1"
|
||||
local save_cwd="$PWD"
|
||||
local dir name
|
||||
local cd_path name
|
||||
|
||||
while [[ -n "$path" ]]; do
|
||||
dir="${path%/*}"
|
||||
if [[ "$dir" != "$path" ]]; then
|
||||
cd "$dir"
|
||||
name="${path##*/}"
|
||||
else
|
||||
name="$path"
|
||||
while [ -n "$path" ]; do
|
||||
cd_path="${path%/*}"
|
||||
if [[ "$cd_path" != "$path" ]]; then
|
||||
cd "$cd_path"
|
||||
fi
|
||||
name="${path##*/}"
|
||||
path="$(resolve_link "$name" || true)"
|
||||
done
|
||||
|
||||
echo "$PWD"
|
||||
cd "$save_cwd"
|
||||
}
|
||||
|
|
15
libexec/bats
15
libexec/bats
|
@ -33,18 +33,17 @@ resolve_link() {
|
|||
abs_dirname() {
|
||||
local path="$1"
|
||||
local save_cwd="$PWD"
|
||||
local dir name
|
||||
local cd_path name
|
||||
|
||||
while [[ -n "$path" ]]; do
|
||||
dir="${path%/*}"
|
||||
if [[ "$dir" != "$path" ]]; then
|
||||
cd "$dir"
|
||||
name="${path##*/}"
|
||||
else
|
||||
name="$path"
|
||||
while [ -n "$path" ]; do
|
||||
cd_path="${path%/*}"
|
||||
if [[ "$cd_path" != "$path" ]]; then
|
||||
cd "$cd_path"
|
||||
fi
|
||||
name="${path##*/}"
|
||||
path="$(resolve_link "$name" || true)"
|
||||
done
|
||||
|
||||
echo "$PWD"
|
||||
cd "$save_cwd"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user