shell脚本之连续日期输出
1.vim test.sh
#!/bin/sh
startdate=`date -d "$1" +%Y-%m-%d`
enddate=`date -d "$2" +%Y-%m-%d`
while [[ $startdate < $enddate ]]
do
echo "########$startdate#########"
startdate=`date -d "+1 day $startdate" +%Y-%m-%d`
done
2.保存 修改权限 chmod 755 test.sh
3.执行 ./test.sh 2022-08-01 2022-08-10