]> Sergey Matveev's repositories - zsh-autoenv.git/commitdiff
Fix return value of _autoenv_source; use ': $(( .. ))'
authorDaniel Hahler <git@thequod.de>
Thu, 23 Apr 2015 12:39:36 +0000 (14:39 +0200)
committerDaniel Hahler <git@thequod.de>
Thu, 23 Apr 2015 12:39:38 +0000 (14:39 +0200)
`(( foo++ ))` returns an error in case $foo is not defined.

autoenv.zsh

index 05ac0b7d8d09e1de48ac65117977a6081d55e683..1a01c0731d436d9ad4be46b46b9b28104b945519 100644 (file)
@@ -238,9 +238,9 @@ _autoenv_source() {
   # Change to directory of env file, source it and cd back.
   local new_dir=$PWD
   _autoenv_debug "== SOURCE: ${bold_color:-}$env_file${reset_color:-}\n      PWD: $PWD"
-  (( _autoenv_debug_indent++ ))
+  : $(( _autoenv_debug_indent++ ))
   source $env_file
-  (( _autoenv_debug_indent-- ))
+  : $(( _autoenv_debug_indent-- ))
   _autoenv_debug "== END SOURCE =="
 
   if [[ $autoenv_event == enter ]]; then
@@ -337,7 +337,7 @@ _autoenv_chpwd_handler() {
 
   _autoenv_chpwd_prev_dir=$PWD
 
-  (( _autoenv_debug_indent++ ))
+  : $(( _autoenv_debug_indent++ ))
 }
 # }}}