1
我有打印日期不正確逗號分隔日期的價值
condition=`date -d "20150209" +%a`
start_date=`date -d -7day"20150209" +%Y%m%d`
end_date=`date -d -1day"20150209" +%Y%m%d`
if [ "$condition" = "Mon" ]
then
while [ "$start_date" != "$end_date" ]
do
Date+=$start_date,
start_date=$(date -d +1day"$start_date" +%Y%m%d)
done
echo "$Date"
fi
我期待輸出
20150203,20150204,20150205,20150206,20150207,20150208
我無法弄清楚什麼是錯誤的代碼。
什麼是*實際*輸出? – 2015-02-10 14:20:29
20150202,20150203,20150204,20150205,20150206,20150207,20150202,20150203,20150204,20150205,20150206,20150207, – 2015-02-10 14:31:56
我得到:'20150202,20150203,20150204,20150205,20150206,20150204,'從上面的代碼。問題是什麼? – anubhava 2015-02-10 14:34:29