fix freebsd
This commit is contained in:
parent
13736a33f8
commit
93f3ee1ac5
@ -51,7 +51,7 @@ function ozsh_update {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ozsh_autoupdate {
|
function ozsh_autoupdate {
|
||||||
local timediff=$(( ($(date --date="$(date)" +%s) - $(date --date="$(cat $OZSH_LASTUPDATE_FILE)" +%s) ) / (60*60*24) ))
|
local timediff=$(( ( $(strftime -r %Y-%m-%d $(date +%Y-%m-%d)) - $(strftime -r %Y-%m-%d $(cat $OZSH_LASTUPDATE_FILE)) ) / 86400 ))
|
||||||
if [ "$timediff" -ge "7" ]; then
|
if [ "$timediff" -ge "7" ]; then
|
||||||
vared -p 'Would you like to update ozsh? [y/N]: ' -c answer
|
vared -p 'Would you like to update ozsh? [y/N]: ' -c answer
|
||||||
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
|
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
|
||||||
@ -68,9 +68,12 @@ function ozsh_init {
|
|||||||
|
|
||||||
# create lastupdate file if not exist
|
# create lastupdate file if not exist
|
||||||
if [ ! -f $OZSH_LASTUPDATE_FILE ]; then
|
if [ ! -f $OZSH_LASTUPDATE_FILE ]; then
|
||||||
echo $(date) > $OZSH_LASTUPDATE_FILE
|
echo $(date +%Y-%m-%d) > $OZSH_LASTUPDATE_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# load the datetime module
|
||||||
|
zmodload zsh/datetime
|
||||||
|
|
||||||
ozsh_autoupdate
|
ozsh_autoupdate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user