aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-06-25 12:05:23 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-06-25 12:05:23 +1200
commita498d3edfafd023125a4618e63ea641d8d532a40 (patch)
tree5d16a5fd6e922e8e728c8670aa5373c27c8d1907 /bash/bashrc.d
parentSet .PHONY properly with generated target list (diff)
downloaddotfiles-a498d3edfafd023125a4618e63ea641d8d532a40.tar.gz
dotfiles-a498d3edfafd023125a4618e63ea641d8d532a40.zip
Switch back to read array split for targets
Works better than the well-intended while-read loop
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/make.bash10
1 files changed, 8 insertions, 2 deletions
diff --git a/bash/bashrc.d/make.bash b/bash/bashrc.d/make.bash
index 094e9657..ca209e8e 100644
--- a/bash/bashrc.d/make.bash
+++ b/bash/bashrc.d/make.bash
@@ -14,7 +14,13 @@ _make() {
*:*)
# Break the target up with space delimiters
- while IFS= read -d ' ' -r target ; do
+ local -a targets
+ IFS=' ' read -a targets -d '' < \
+ <(printf '%s\0' "${line%%:*}")
+
+ # Iterate through the targets and add suitable ones
+ local target
+ for target in "${targets[@]}" ; do
case $target in
# Don't complete special targets beginning with a
@@ -30,7 +36,7 @@ _make() {
COMPREPLY[${#COMPREPLY[@]}]=$target
;;
esac
- done < <(printf '%s' "${line%%:*}")
+ done
;;
esac
done < Makefile