判断闰年的程序代码;shell实现


read -p "你想判断的年份是:" a
c=`expr $a % 4`
d=`expr $a % 100`
e=`expr $a % 400`
if [ $c == 0 -a $d != 0 ]
then
echo"你输入的是一个闰年!!!"
elif [ $e == 0 ]
then
echo"你输入的是一个世纪闰年!!!"
else
echo"你输入的不是一个闰年!!!"
fi

 

相关文章

Centos系统之Shell编程基础知识
从Export理解Shell环境和变量生存期
linux shell数组变量、类型及规则
Centos编程Shell基本工作原理方案
Centos操作系统编程之Shell 问答录
rsync-linux备份脚本