我的脚本:
currenttime=$(date +%H:%M) if [[ "$currenttime" > "00:00" ]] && [[ "$currenttime" < "01:00" ]]; then ./mailscript1.sh else ./mailscript2.sh fi
在这里我希望它应包括00:00和01:00并应触发mailscript1为true,> =和<=无法正常工作
使用+%s(纪元格式)比较时间,依此类推:
currenttime=$(date +$s) if [[ "$currenttime" -ge "$(date -d "00:00" +%s)" && "$currenttime" -le "$(date -d "01:00" +%s)" ]] then ./mailscript1.sh else ./mailscript2.sh fi
1.4m articles
1.4m replys
5 comments
57.0k users