summaryrefslogtreecommitdiffstats
path: root/system/edit-config
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:04 +0000
commita836a244a3d2bdd4da1ee2641e3e957850668cea (patch)
treecb87c75b3677fab7144f868435243f864048a1e6 /system/edit-config
parentAdding upstream version 1.38.1. (diff)
downloadnetdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.tar.xz
netdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.zip
Adding upstream version 1.39.0.upstream/1.39.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xsystem/edit-config16
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