[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Enable compgen even when programmable completions are not available?
From: |
Fabien Orjollet |
Subject: |
Re: Enable compgen even when programmable completions are not available? |
Date: |
Tue, 27 Jun 2023 18:37:37 +0200 |
I'm far from having the skills of the people here. However, I found the
problem interesting. I think I've come up with a reasonable solution
(you tell me). Although it's not as short as Kerin Millar's, I think it
offers some improvements. I hope there are no particular weaknesses.
If it's of any use to anyone.
declare-P() {
local curVar
declare -a curVars
readarray -t curVars <<<"$1"
curVars=( "${curVars[@]%%=*}" )
curVars=( "${curVars[@]##* }" )
for curVar in "${curVars[@]}"; do
### unfortunately, we cannot use [[ -v "$curVar" ]]
[[ "${curVar//[a-zA-Z0-9_]}" || \
"${curVar:0:1}" == [0-9] || \
! "$curVar" =~ $2 ]] || printf '%s\n' "$curVar"
done
}
declare-P "$(declare -p)"
echo "##################"
declare-P "$(declare -p)" "TERM"
echo "##################"
declare-P "$(declare -p)" "^BASH|^SHELL"
- Re: Enable compgen even when programmable completions are not available?, (continued)
- Re: Enable compgen even when programmable completions are not available?, Robert Elz, 2023/06/30
- Re: Enable compgen even when programmable completions are not available?, Kerin Millar, 2023/06/30
- Re: Enable compgen even when programmable completions are not available?, Eli Schwartz, 2023/06/30
- Re: Enable compgen even when programmable completions are not available?, Robert Elz, 2023/06/30
- Re: Enable compgen even when programmable completions are not available?, Kerin Millar, 2023/06/30
- Re: Enable compgen even when programmable completions are not available?, Eli Schwartz, 2023/06/30
Re: Enable compgen even when programmable completions are not available?,
Fabien Orjollet <=
- Re: Enable compgen even when programmable completions are not available?, Kerin Millar, 2023/06/27
- Re: Enable compgen even when programmable completions are not available?, of1, 2023/06/27
- Re: Enable compgen even when programmable completions are not available?, Kerin Millar, 2023/06/27
- Re: Enable compgen even when programmable completions are not available?, Fabien Orjollet, 2023/06/28
- Re: Enable compgen even when programmable completions are not available?, Fabien Orjollet, 2023/06/28
- Re: Enable compgen even when programmable completions are not available?, Kerin Millar, 2023/06/28
- Re: Enable compgen even when programmable completions are not available?, Fabien Orjollet, 2023/06/28