diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index dee657d..65632af 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,7 +2,7 @@ default_language_version:
   python: python3
 repos:
 - repo: https://github.com/pre-commit/pre-commit-hooks
-  rev: v4.1.0
+  rev: v4.3.0
   hooks:
   - id: check-added-large-files
   - id: check-case-conflict
@@ -39,7 +39,7 @@ repos:
     - flake8-string-format
     - flake8-type-annotations
 - repo: https://github.com/pre-commit/mirrors-mypy
-  rev: v0.930
+  rev: v0.961
   hooks:
   - id: mypy
 - repo: https://github.com/google/yapf
diff --git a/shtab/__init__.py b/shtab/__init__.py
index 5467cfd..87ca026 100644
--- a/shtab/__init__.py
+++ b/shtab/__init__.py
@@ -225,8 +225,8 @@ def recurse(parser, prefix):
                         this_positional_choices.append(str(choice))
 
                 if this_positional_choices:
-                    choices.append(u"{}_pos_{}_choices='{}'".format(
-                        prefix, i, " ".join(this_positional_choices)))
+                    choices.append(u"{}_pos_{}_choices=('{}')".format(
+                        prefix, i, "' '".join(this_positional_choices)))
 
             # skip default `nargs` values
             if positional.nargs not in (None, "1", "?"):
@@ -266,8 +266,8 @@ def recurse(parser, prefix):
                             this_optional_choices.append(str(choice))
 
                     if this_optional_choices:
-                        choices.append(u"{}_{}_choices='{}'".format(
-                            prefix, wordify(option_string), " ".join(this_optional_choices)))
+                        choices.append(u"{}_{}_choices=('{}')".format(
+                            prefix, wordify(option_string), "' '".join(this_optional_choices)))
 
                 # Check for nargs.
                 if optional.nargs is not None and optional.nargs != 1:
@@ -421,8 +421,9 @@ def complete_bash(parser, root_prefix=None, preamble="", choice_functions=None):
     COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") )
   else
     # use choices & compgen
-    COMPREPLY=( $(compgen -W "${current_action_choices}" -- "${completing_word}"; \\
-                  [ -n "${current_action_compgen}" ] \\
+    local IFS=$'\\n'
+    COMPREPLY=( $(compgen -W "${current_action_choices}" -- "${completing_word}") \\
+                $([ -n "${current_action_compgen}" ] \\
                   && "${current_action_compgen}" "${completing_word}") )
   fi
 
diff --git a/tests/test_shtab.py b/tests/test_shtab.py
index fc8d09c..a7fbc19 100644
--- a/tests/test_shtab.py
+++ b/tests/test_shtab.py
@@ -197,11 +197,11 @@ def test_subparser_aliases(shell, caplog):
     if shell == "bash":
         shell = Bash(completion)
         shell.compgen('-W "${_shtab_test_subparsers[*]}"', "s", "sub")
-        shell.compgen('-W "$_shtab_test_pos_0_choices"', "s", "sub")
+        shell.compgen('-W "${_shtab_test_pos_0_choices[*]}"', "s", "sub")
         shell.compgen('-W "${_shtab_test_subparsers[*]}"', "x", "xsub")
-        shell.compgen('-W "$_shtab_test_pos_0_choices"', "x", "xsub")
+        shell.compgen('-W "${_shtab_test_pos_0_choices[*]}"', "x", "xsub")
         shell.compgen('-W "${_shtab_test_subparsers[*]}"', "y", "ysub")
-        shell.compgen('-W "$_shtab_test_pos_0_choices"', "y", "ysub")
+        shell.compgen('-W "${_shtab_test_pos_0_choices[*]}"', "y", "ysub")
         shell.test('"$($_shtab_test_sub_pos_0_COMPGEN o)" = "one"')
         shell.test('-z "$_shtab_test_COMPGEN"')
 
@@ -245,9 +245,9 @@ def test_add_argument_to_positional(shell, caplog, capsys):
     if shell == "bash":
         shell = Bash(completion)
         shell.compgen('-W "${_shtab_test_subparsers[*]}"', "c", "completion")
-        shell.compgen('-W "$_shtab_test_pos_0_choices"', "c", "completion")
-        shell.compgen('-W "$_shtab_test_completion_pos_0_choices"', "ba", "bash")
-        shell.compgen('-W "$_shtab_test_completion_pos_0_choices"', "z", "zsh")
+        shell.compgen('-W "${_shtab_test_pos_0_choices[*]}"', "c", "completion")
+        shell.compgen('-W "${_shtab_test_completion_pos_0_choices[*]}"', "ba", "bash")
+        shell.compgen('-W "${_shtab_test_completion_pos_0_choices[*]}"', "z", "zsh")
 
     assert not caplog.record_tuples