diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-08 16:27:08 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-08 16:27:08 +0000 |
commit | 81581f9719bc56f01d5aa08952671d65fda9867a (patch) | |
tree | 0f5c6b6138bf169c23c9d24b1fc0a3521385cb18 /system/edit-config | |
parent | Releasing debian version 1.38.1-1. (diff) | |
download | netdata-81581f9719bc56f01d5aa08952671d65fda9867a.tar.xz netdata-81581f9719bc56f01d5aa08952671d65fda9867a.zip |
Merging upstream version 1.39.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'system/edit-config')
-rwxr-xr-x | system/edit-config | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/system/edit-config b/system/edit-config index 754f9374a..96ee82d4f 100755 --- a/system/edit-config +++ b/system/edit-config @@ -34,10 +34,20 @@ error() { } abspath() { - if [ -d "${1}" ]; then + if [ -d "${1}/" ]; then 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}")" + 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 } @@ -153,7 +163,7 @@ list_files() { check_directories handle_container - if test -t; then + if test -t && command -v tput > /dev/null 2>&1; then width="$(tput cols)" fi |