function todaywords()
{
FILE_PATH="/home/xxxxxx/.list"
if [ $# -eq 0 ]; then
today=$(date +%-j)
((today%=67))
start=$today
((start*=100))
((start+=1))
end=$start
((end+=99))
sed -n "${start},${end}p" $FILE_PATH
fi
{
FILE_PATH="/home/xxxxxx/.list"
if [ $# -eq 0 ]; then
today=$(date +%-j)
((today%=67))
start=$today
((start*=100))
((start+=1))
end=$start
((end+=99))
sed -n "${start},${end}p" $FILE_PATH
fi
}
原来:
today=$(date +%j)
在1月8日,执行结果是008,0开头的被认为是八进制数,其取值范围0-7,数值8越界,所以报错(-bash: ((: 008: 基数值过大 (error token is "008"))。
后来:
today=$(date +%-j)
执行结果是8,被认为是十进制数,执行正常。