diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2014-02-19 10:55:03 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2014-02-19 10:55:03 +1300 |
commit | 8ca63835a726bc41e51a87195fd382d694225a06 (patch) | |
tree | a8ed3677b907c06d707f0d4e4ca5af7c8db88739 /bash/bashrc.d | |
parent | Don't print error messages for old Bash (diff) | |
download | dotfiles-8ca63835a726bc41e51a87195fd382d694225a06.tar.gz dotfiles-8ca63835a726bc41e51a87195fd382d694225a06.zip |
Avoid ambiguous conditional syntax
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r-- | bash/bashrc.d/cf.bash | 16 | ||||
-rw-r--r-- | bash/bashrc.d/vim.bash | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/bash/bashrc.d/cf.bash b/bash/bashrc.d/cf.bash index 1a375021..715f0f5b 100644 --- a/bash/bashrc.d/cf.bash +++ b/bash/bashrc.d/cf.bash @@ -22,16 +22,24 @@ cf() { fi # Record current state of dotglob and nullglob - shopt -pq dotglob && dgs=1 - shopt -pq nullglob && ngs=1 + if shopt -pq dotglob ; then + dgs=1 + fi + if shopt -pq nullglob ; then + ngs=1 + fi # Retrieve the files array shopt -s dotglob nullglob files=("$dir"/*) # Reset our options - ((dgs)) || shopt -u dotglob - ((ngs)) || shopt -u nullglob + if ! ((dgs)) ; then + shopt -u dotglob + fi + if ! ((ngs)) ; then + shopt -u nullglob + fi # Print result printf '%d\t%s\n' \ diff --git a/bash/bashrc.d/vim.bash b/bash/bashrc.d/vim.bash index b929cf80..fde18def 100644 --- a/bash/bashrc.d/vim.bash +++ b/bash/bashrc.d/vim.bash @@ -29,7 +29,9 @@ vis() { for cmd in "${cmds[@]}" ; do file=$(type -p "${cmd##*/}") if [[ ! $file ]] ; then - mkdir -p "$HOME"/.local/bin || exit + if ! mkdir -p "$HOME"/.local/bin ; then + exit + fi file="$HOME"/.local/bin/"${cmd##*/}" fi files=("${files[@]}" "$file") |