initctl: fix edit command fallback handling

If mg doesn't exist, command doesn't evaluate the second argument (vi),
so we need to use `... || command -v vi` instead.  Found during demo,
because why not.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-03-01 17:36:06 +01:00
parent dc49b523d1
commit 8355c37285
+1 -1
View File
@@ -270,7 +270,7 @@ static int do_edit(char *arg, int creat)
char *editor[] = {
"sensible-editor",
"editor",
"${VISUAL:-${EDITOR:-$(command -v mg vi | head -1)}}"
"${VISUAL:-${EDITOR:-$(command -v mg || command -v vi)}}"
};
char path[256];
char *fn;