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/cf.bash | |
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/cf.bash')
-rw-r--r-- | bash/bashrc.d/cf.bash | 16 |
1 files changed, 12 insertions, 4 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' \ |