diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-21 13:56:11 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-21 13:56:11 +1300 |
commit | f0119fb15a6de2dc4b54da6ee8b4a9e22b6e7603 (patch) | |
tree | 05d6638e5e52d02fad7ce0292acfc01aed902e91 /bash/bashrc.d | |
parent | When expanding with globbing, use prefix (diff) | |
download | dotfiles-f0119fb15a6de2dc4b54da6ee8b4a9e22b6e7603.tar.gz dotfiles-f0119fb15a6de2dc4b54da6ee8b4a9e22b6e7603.zip |
Move quoting into generating loop
Avoids yet another subshell
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r-- | bash/bashrc.d/pass.bash | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bash/bashrc.d/pass.bash b/bash/bashrc.d/pass.bash index 12539a17..e2bc20fc 100644 --- a/bash/bashrc.d/pass.bash +++ b/bash/bashrc.d/pass.bash @@ -18,7 +18,8 @@ _pass() # We have to use printf %q here to quote the entry, as it may include # spaces or newlines, just like any filename - COMPREPLY=("${COMPREPLY[@]}" "$(printf %q "$entry")") + COMPREPLY=("${COMPREPLY[@]}" "$entry") + done < <( # Set shell options to expand globs the way we expect @@ -37,7 +38,7 @@ _pass() ((${#entries[@]})) || exit 1 # Print all the entries, null-delimited - printf '%s\0' "${entries[@]}" + printf '%q\0' "${entries[@]}" ) } complete -F _pass pass |