From 4941cdb07498fd095f0d1d029113de1ddd4fc67c Mon Sep 17 00:00:00 2001 From: kt programs Date: Mon, 30 Jan 2023 10:33:50 +0800 Subject: [PATCH] _get_command_arguments: make trailing space optional When pane_full_command has no arguments, the regex doesn't find argv[0] as there is no trailing space. For example, if pane_full_command was "vim" and the restore option was "~Vim->vim *", the command "vim vim" would get executed instead of just "vim". Make the trailing space optional to match having only the command without arguments. --- scripts/process_restore_helpers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/process_restore_helpers.sh b/scripts/process_restore_helpers.sh index 49d3844..8bf5a78 100644 --- a/scripts/process_restore_helpers.sh +++ b/scripts/process_restore_helpers.sh @@ -121,7 +121,7 @@ _get_command_arguments() { if _proc_starts_with_tildae "$match"; then match="$(remove_first_char "$match")" fi - echo "$pane_full_command" | sed "s,^.*${match}[^ ]* ,," + echo "$pane_full_command" | sed "s,^.*${match}[^ ]* *,," } _get_proc_restore_command() {