#!/bin/bash
read -p "请输入一个数字(1-7):" d
if ! [[ $d =~ ^[0-9]+$ ]]; then
echo "输入错误,请输入一个数字。"
exit 1
fi
d=$((d % 7))
if [ $d -eq 0 ]; then
d=7
fi
weekdays=("Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday")
echo "${weekdays[$d - 1]}"