我用 Codex + QVeris 跑通了一套 AI 产业链卡点研究 SOP
2026/7/2 4:35:54
在编程和脚本编写的过程中,我们常常会遇到各种问题和挑战,需要使用一些实用的脚本和工具来解决。下面将为大家详细介绍几个常见的脚本及其功能、使用方法和改进思路。
日期验证脚本用于验证用户输入的日期是否合法。它会检查月份和日期的有效性,同时还会考虑闰年的情况。
month="$(echo $newdate | cut -d\ -f1)" day="$(echo $newdate | cut -d\ -f2)" year="$(echo $newdate | cut -d\ -f3)" # Now that we have a normalized date, let's check whether the # day value is legal and valid (e.g., not Jan 36). if ! exceedsDaysInMonth $month "$2" ; then if [ "$month" = "Feb" -a "$2" -eq "29" ] ; then if ! isLeapYear $3 ; then echo "$0: $3 is not a leap year, so Feb doesn't have 29 days." >&2 exit 1 fi else echo "$0: bad day value: $month doesn't have $2 days." >&2 exit 1