]> Sergey Matveev's repositories - zsh-autoenv.git/commitdiff
Fix _autoenv_get_file_mtime for zsh 4 (no pipefail option)
authorDaniel Hahler <git@thequod.de>
Thu, 23 Apr 2015 17:55:21 +0000 (19:55 +0200)
committerDaniel Hahler <git@thequod.de>
Thu, 23 Apr 2015 17:55:21 +0000 (19:55 +0200)
autoenv.zsh

index 2fb77ce966da17e50d20e7000216e59e307e6dcd..772b1903195aa56f21de38535f5d5a9de09fe84f 100644 (file)
@@ -66,8 +66,14 @@ if ! zmodload -F zsh/stat b:zstat 2>/dev/null; then
   # terse output instead of format, which is not supported by busybox.
   # Assume '+mtime' as $1.
   _autoenv_get_file_mtime() {
-    setopt localoptions pipefail
-    stat -t $1 2>/dev/null | cut -f13 -d ' ' || echo 0
+    # setopt localoptions pipefail
+    local stat
+    stat=$(stat -t $1 2>/dev/null)
+    if [[ -n $stat ]]; then
+      echo ${${(s: :)stat}[13]}
+    else
+      echo 0
+    fi
   }
 else
   _autoenv_get_file_mtime() {