@cryptotaxi247 / netdata-1 / commits / 06b7c5026

edit-config: Better support for custom editors. (#4551)

* edit-config: Better support for custom editors. Some systems (Debian for example) don't use the `$EDITOR` environment variable to specify the preferred default editor. On most such systems, there is instead a symbolic link (or a shell script) called `editor` located somewhere in `$PATH` which will invoke the appropriate command. This updates the `edit-config` script to use this command if present in preference to just invoking `vi` as the editor. * Add missing quotes.

Austin S. Hemmelgarn committed Nov 2, 2018 at 14:28 UTC 06b7c5026953a1808c9b8617b9b6d3fe6a75244e
1 file changed +6 -1
system/edit-config.in
+6 -1
@@ -4,7 +4,12 @@
4
5 file="${1}"
6
7 -EDITOR="${EDITOR-vi}"
7 +if [ "$(command -v editor)" ] ; then
8 + EDITOR="${EDITOR-editor}"
9 +else
10 + EDITOR="${EDITOR-vi}"
11 +fi
12 +
13 [ -z "${NETDATA_USER_CONFIG_DIR}" ] && NETDATA_USER_CONFIG_DIR="@configdir_POST@"
14 [ -z "${NETDATA_STOCK_CONFIG_DIR}" ] && NETDATA_STOCK_CONFIG_DIR="@libconfigdir_POST@"
15