62abacebea3f93514e41720c689399bcdc74ff39

Author
David Remy <19895637+dpremy@users.noreply.github.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

lib: fix issues with nounset and parameters used before defined (#7433)

Diff

 1diff --git a/lib/history.zsh b/lib/history.zsh
 2index d8bbd41c448563b7ad67cc1741c90eec9c121165..52e45bf4ca7776c3415110f8678ccd2dbe451071 100644
 3--- a/lib/history.zsh
 4+++ b/lib/history.zsh
 5@@ -12,12 +12,12 @@ function omz_history {
 6     builtin fc "$@"
 7   else
 8     # unless a number is provided, show all history events (starting from 1)
 9-    [[ ${@[-1]} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
10+    [[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
11   fi
12 }
13 
14 # Timestamp format
15-case $HIST_STAMPS in
16+case ${HIST_STAMPS-} in
17   "mm/dd/yyyy") alias history='omz_history -f' ;;
18   "dd.mm.yyyy") alias history='omz_history -E' ;;
19   "yyyy-mm-dd") alias history='omz_history -i' ;;