shell编程实现返回一个数组
shell编程实现最好是用函数传入两个时间字符串“2013-10-1”“2013-10-5”然后获得“2013-10-1”“2013-10-2”“2013-10-3”“2...
shell编程实现 最好是用函数
传入两个时间字符串 “2013-10-1” “2013-10-5”
然后获得
“2013-10-1”
“2013-10-2”
“2013-10-3”
“2013-10-4”
“2013-10-5” 展开
传入两个时间字符串 “2013-10-1” “2013-10-5”
然后获得
“2013-10-1”
“2013-10-2”
“2013-10-3”
“2013-10-4”
“2013-10-5” 展开
3个回答
展开全部
#!/bin/bash
func()
{
START=$1
END=$2
awk -vstartt="$START" -vendt="$END" 'BEGIN{
startm=mktime(gensub("-", " ", "g", startt) " 0 0 0")
endtm=mktime(gensub("-", " ", "g", endt) " 0 0 0")
for(i=startm;i<=endtm;i+=3600*24)
print strftime("%Y-%m-%d", i)
}'
}
func "2013-10-1" "2013-10-5"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询