#!/usr/bin/env bash
echo "please input a month(0~12):"
read month
j=0
if [ $month -gt 12 ] || [ $month -lt 0 ];
then
echo "the month is not in 0~12!"
else
for i in jan feb mar apr may june july aug sep oct nov dec
do
let j+=1;
if [[ $month = $j ]];then
echo "the $month month is $i! "
else
continue
fi
done
fi
这是一个Bash脚本,用于根据用户输入的月份数字(0~12)输出相应的英文月份名称。如果输入不在范围内,脚本会提示月份无效。

1万+

被折叠的 条评论
为什么被折叠?



