1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/bin/sh
- is_not_holidays() {
- if [ -z "$1" ]; then
- echo "0"
- return
- fi
-
- path=$(dirname $0)
- if grep -w "$1" "${path}/holidays.txt" > /dev/null; then
- echo "0"
- else
- echo "1"
- fi
- }
- get_day_of_week() {
- local format="${1:-chinese}"
-
- case "$format" in
- "full") # 完整星期名称(Monday, Tuesday, etc.)
- date +%A
- ;;
- "short") # 缩写星期名称(Mon, Tue, etc.)
- date +%a
- ;;
- "num1") # 数字表示(1-7,周一到周日)
- date +%u
- ;;
- "num0") # 数字表示(0-6,周日到周六)
- date +%w
- ;;
- "chinese") # 中文星期(星期一,星期二,等等)
- LC_ALL=zh_CN.UTF-8 date +%A
- ;;
- *)
- echo "Invalid format. Use 'full', 'short', 'num1', 'num0', or 'chinese'."
- ;;
- esac
- }
|