From cb347cb208c5708e30aa3d847849aa6ce71ba814 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Wed, 10 May 2023 22:41:14 +0900 Subject: [PATCH] fix(ps,ss): avoid extra expansions by -W "$(...)" in _comp_delimited --- completions/ps | 3 ++- completions/ss | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/completions/ps b/completions/ps index d32083ecea4..38732d183b2 100644 --- a/completions/ps +++ b/completions/ps @@ -50,7 +50,8 @@ _comp_cmd_ps() --format | ?(-)[Oo] | [^-]*[Oo]) # TODO: This doesn't work well when there are multiple options for # the non-first item (similarly to useradd --groups and others). - _comp_delimited , -W "$("$1" L | awk '{ print $1 }')" + local labels=$("$1" L | awk '{ print $1 }') + _comp_delimited , -W '$labels' return ;; esac diff --git a/completions/ss b/completions/ss index 08ddf5edc0a..e383fe57a8a 100644 --- a/completions/ss +++ b/completions/ss @@ -16,8 +16,9 @@ _comp_cmd_ss() return ;; --query | -${noargopts}A) - _comp_delimited , -W "$("$1" --help | - command sed -e 's/|/ /g' -ne 's/.*QUERY := {\([^}]*\)}.*/\1/p')" + local queries=$("$1" --help | + command sed -e 's/|/ /g' -ne 's/.*QUERY := {\([^}]*\)}.*/\1/p') + _comp_delimited , -W '$queries' return ;; --diag | --filter | -${noargopts}[DF])