diff --git a/shell-completion/hledger-completion.bash b/shell-completion/hledger-completion.bash index a8560f5cf..c49151285 100644 --- a/shell-completion/hledger-completion.bash +++ b/shell-completion/hledger-completion.bash @@ -34,7 +34,7 @@ _hledger_completion_function() { # Do not ignore them! if [[ $subcommand == "$cur" ]] && ((i == cword)); then local subcommandMatches - subcommandMatches=$(grep -c "^$cur" <<< "$_hledger_complist_commands") + subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands") if ((subcommandMatches > 1)); then subcommand= break diff --git a/shell-completion/hledger-completion.bash.m4 b/shell-completion/hledger-completion.bash.m4 index 20e853fd4..45eca0418 100644 --- a/shell-completion/hledger-completion.bash.m4 +++ b/shell-completion/hledger-completion.bash.m4 @@ -34,7 +34,7 @@ _hledger_completion_function() { # Do not ignore them! if [[ $subcommand == "$cur" ]] && ((i == cword)); then local subcommandMatches - subcommandMatches=$(grep -c "^$cur" <<< "$_hledger_complist_commands") + subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands") if ((subcommandMatches > 1)); then subcommand= break