aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/bash-completion
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2018-10-20 18:01:50 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-10-21 14:45:14 -0400
commitfe8ecccc10b3adc071de05ca7af728ca1a4ac9aa (patch)
treee331ea6c91c3da4fc356cbaed02d0cceff29bdbb /tools/bpf/bpftool/bash-completion
parent06ee9da6a8b49e0e12b7a825dbe6ad243d5463e2 (diff)
tools: bpftool: fix completion for "bpftool map update"
When trying to complete "bpftool map update" commands, the call to printf would print an error message that would show on the command line if no map is found to complete the command line. Fix it by making sure we have map ids to complete the line with, before we try to print something. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/bpf/bpftool/bash-completion')
-rw-r--r--tools/bpf/bpftool/bash-completion/bpftool2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
index c56545e87b0d..3f78e6404589 100644
--- a/tools/bpf/bpftool/bash-completion/bpftool
+++ b/tools/bpf/bpftool/bash-completion/bpftool
@@ -143,7 +143,7 @@ _bpftool_map_update_map_type()
143 local type 143 local type
144 type=$(bpftool -jp map show $keyword $ref | \ 144 type=$(bpftool -jp map show $keyword $ref | \
145 command sed -n 's/.*"type": "\(.*\)",$/\1/p') 145 command sed -n 's/.*"type": "\(.*\)",$/\1/p')
146 printf $type 146 [[ -n $type ]] && printf $type
147} 147}
148 148
149_bpftool_map_update_get_id() 149_bpftool_map_update_get_id()