mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 11:42:33 +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() {
|
abs_dirname() {
|
||||||
local path="$1"
|
local path="$1"
|
||||||
local save_cwd="$PWD"
|
local save_cwd="$PWD"
|
||||||
local dir name
|
local cd_path name
|
||||||
|
|
||||||
while [[ -n "$path" ]]; do
|
while [ -n "$path" ]; do
|
||||||
dir="${path%/*}"
|
cd_path="${path%/*}"
|
||||||
if [[ "$dir" != "$path" ]]; then
|
if [[ "$cd_path" != "$path" ]]; then
|
||||||
cd "$dir"
|
cd "$cd_path"
|
||||||
name="${path##*/}"
|
|
||||||
else
|
|
||||||
name="$path"
|
|
||||||
fi
|
fi
|
||||||
|
name="${path##*/}"
|
||||||
path="$(resolve_link "$name" || true)"
|
path="$(resolve_link "$name" || true)"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "$PWD"
|
echo "$PWD"
|
||||||
cd "$save_cwd"
|
cd "$save_cwd"
|
||||||
}
|
}
|
||||||
|
|
15
libexec/bats
15
libexec/bats
|
@ -33,18 +33,17 @@ resolve_link() {
|
||||||
abs_dirname() {
|
abs_dirname() {
|
||||||
local path="$1"
|
local path="$1"
|
||||||
local save_cwd="$PWD"
|
local save_cwd="$PWD"
|
||||||
local dir name
|
local cd_path name
|
||||||
|
|
||||||
while [[ -n "$path" ]]; do
|
while [ -n "$path" ]; do
|
||||||
dir="${path%/*}"
|
cd_path="${path%/*}"
|
||||||
if [[ "$dir" != "$path" ]]; then
|
if [[ "$cd_path" != "$path" ]]; then
|
||||||
cd "$dir"
|
cd "$cd_path"
|
||||||
name="${path##*/}"
|
|
||||||
else
|
|
||||||
name="$path"
|
|
||||||
fi
|
fi
|
||||||
|
name="${path##*/}"
|
||||||
path="$(resolve_link "$name" || true)"
|
path="$(resolve_link "$name" || true)"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "$PWD"
|
echo "$PWD"
|
||||||
cd "$save_cwd"
|
cd "$save_cwd"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user