aboutsummaryrefslogtreecommitdiff
path: root/bash-completion
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2023-02-01 20:03:16 +0600
committerMike Frysinger <vapier@gmail.com>2023-02-02 19:37:09 -0500
commit36cc40a9d641058ae69ca64a4661d5900098ab12 (patch)
tree28496dfcdf22ed0625be41d0ea8ff1c45dd52092 /bash-completion
parentae5e38dce5bd7b30adb3131e7e76fab34a6f5c73 (diff)
bash-completions/rc-service: don't use grep
Co-authored-by: Mike Frysinger <vapier@gentoo.org> Closes: https://github.com/OpenRC/openrc/issues/344
Diffstat (limited to 'bash-completion')
-rw-r--r--bash-completion/rc-service11
1 files changed, 5 insertions, 6 deletions
diff --git a/bash-completion/rc-service b/bash-completion/rc-service
index a197655f..4e9e076e 100644
--- a/bash-completion/rc-service
+++ b/bash-completion/rc-service
@@ -85,9 +85,9 @@ _rc_service()
else
# no option was typed
if [[ ${COMP_CWORD} -eq 1 ]]; then # if first word typed
- words="$(rc-service --list | grep ^${cur})" # complete for init scripts
- COMPREPLY=($(for i in ${words} ; do \
- [[ ${i} == ${cur}* ]] && echo ${i} ; \
+ # complete for init scripts
+ COMPREPLY=($(for i in $(rc-service --list) ; do \
+ [[ ${i} == "${cur}"* ]] && echo ${i} ; \
done))
return 0
elif [[ ${COMP_CWORD} -eq 2 ]] && [[ ${prev} != -* ]]; then # if second word typed and we didn't type in a function
@@ -105,9 +105,8 @@ _rc_service()
fi
if [[ ${action} == '--exists' ]] || [[ ${action} == '-e' ]] || \
[[ ${action} == '--resolve' ]] || [[ ${action} == '-r' ]]; then
- words="$(rc-service --list | grep ^${cur})"
- COMPREPLY=($(for i in ${words} ; do \
- [[ ${i} == ${cur}* ]] && echo ${i} ; \
+ COMPREPLY=($(for i in $(rc-service --list) ; do \
+ [[ ${i} == "${cur}"* ]] && echo ${i} ; \
done))
return 0
fi