aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/keep.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-02 23:12:15 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-02 23:12:15 +1300
commit456ccb394342528e1d3a8e17277a51039c9c2549 (patch)
tree7d85c2282553762caa50c6d675c97709d51d2c2b /bash/bashrc.d/keep.bash
parentMerge branch 'release/v2.7.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-2.8.0.tar.gz (sig)
dotfiles-2.8.0.zip
Merge branch 'release/v2.8.0'v2.8.0
* release/v2.8.0: Bump VERSION Use native filename quoting for td(1df) complete Make bd() and sd() match quoted and unquoted words Remove unneeded braces Use variable for node count, not expansion Use simple loop rather than glob tricks in keep Move error increment to outside of if block Add missing source of helper func to man complete Remove unneeded local var Trim some trailing whitespace Correct manpath(1) command in man completion Adjust quoting and termination for man completion Update glob settings for manual page completion Make `sec` a local var in man page completion Remove unneeded `local` declaration Reorder pattern filters for Makefile lines Add some comments to keep() completion Correct find(1) completion to subshell exit Correct completion quoting for eds(1df)
Diffstat (limited to 'bash/bashrc.d/keep.bash')
-rw-r--r--bash/bashrc.d/keep.bash24
1 files changed, 11 insertions, 13 deletions
diff --git a/bash/bashrc.d/keep.bash b/bash/bashrc.d/keep.bash
index a39d2fa7..48196aeb 100644
--- a/bash/bashrc.d/keep.bash
+++ b/bash/bashrc.d/keep.bash
@@ -101,19 +101,17 @@ EOF
# If -d was given, delete the keep files for the NAME
if ((delete)) ; then
- rm -- "$bashkeep"/"$name".bash ||
- ((errors++))
+ rm -- "$bashkeep"/"$name".bash
# Save a function
elif [[ $(type -t "$name") = 'function' ]] ; then
- declare -f -- "$name" >"$bashkeep"/"$name".bash ||
- ((errors++))
+ declare -f -- "$name" >"$bashkeep"/"$name".bash
# Save a variable
elif declare -p -- "$name" >/dev/null ; then
- declare -p -- "$name" >"$bashkeep"/"$name".bash ||
- ((errors++))
- fi
+ declare -p -- "$name" >"$bashkeep"/"$name".bash
+
+ fi || ((errors++))
;;
esac
done
@@ -132,12 +130,12 @@ EOF
# Otherwise the user must want us to print all the NAMEs kept
(
shopt -s nullglob
- declare -a keeps
- keeps=("$bashkeep"/*.bash)
- keeps=("${keeps[@]##*/}")
- keeps=("${keeps[@]%.bash}")
- ((${#keeps[@]})) || exit 0
- printf '%s\n' "${keeps[@]}"
+ for keep in "$bashkeep"/*.bash ; do
+ ! [[ -d $keep ]] || continue
+ keep=${keep##*/}
+ keep=${keep%.bash}
+ printf '%s\n' "$keep"
+ done
)
}