From 6aa5ef63ce52df598b73c496955f1c0fddd01fb4 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Fri, 9 Feb 2024 00:49:07 +0100 Subject: [PATCH] Tools: setup-unit: ctl edit: Append suffix to tmp file name This allows the editor(1) to enable syntax highlighting. See suffixes(7). Cc: Liam Crilly Reviewed-by: Andrew Clayton Signed-off-by: Alejandro Colomar --- tools/setup-unit | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/setup-unit b/tools/setup-unit index 5fb7218e..a0dafe10 100755 --- a/tools/setup-unit +++ b/tools/setup-unit @@ -421,7 +421,12 @@ unit_ctl_edit() fi; local req_path="$1"; - local tmp="$(mktemp)"; + echo "$req_path" \ + | sed 's%^/js_modules/.*%.js%' \ + | sed 's%^/config\>.*%.json%' \ + | sed 's%^/.*%.txt%' \ + | xargs mktemp --suffix \ + | read -r tmp; unit_ctl_http ---s "$sock" -c --no-progress-meter GET "$req_path" \ "$tmp";