mirror of
https://github.com/netdata/netdata.git
synced 2025-04-13 01:08:11 +00:00
Fix two issues with the edit-config script. (#14545)
Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
This commit is contained in:
parent
bde40023ed
commit
faf2c718f0
1 changed files with 12 additions and 2 deletions
|
@ -34,10 +34,20 @@ error() {
|
||||||
}
|
}
|
||||||
|
|
||||||
abspath() {
|
abspath() {
|
||||||
if [ -d "${1}" ]; then
|
if [ -d "${1}/" ]; then
|
||||||
echo "$(cd "${1}" && /usr/bin/env PWD= pwd -P)/"
|
echo "$(cd "${1}" && /usr/bin/env PWD= pwd -P)/"
|
||||||
else
|
elif [ -f "${1}" ]; then
|
||||||
echo "$(cd "$(dirname "${1}")" && /usr/bin/env PWD= pwd -P)/$(basename "${1}")"
|
echo "$(cd "$(dirname "${1}")" && /usr/bin/env PWD= pwd -P)/$(basename "${1}")"
|
||||||
|
elif echo "${1}" | grep -q '/'; then
|
||||||
|
if echo "${1}" | grep -q '^/'; then
|
||||||
|
mkdir -p "$(dirname "${1}")"
|
||||||
|
echo "$(cd "$(dirname "${1}")" && /usr/bin/env PWD= pwd -P)/$(basename "${1}")"
|
||||||
|
else
|
||||||
|
mkdir -p "${script_dir}/$(dirname "${1}")"
|
||||||
|
echo "${script_dir}/${1}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${script_dir}/${1}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue