今天同步文件的时候发现了这个问题:

原因是:

tar_file_month=`date +%m`
rsync -auzq --exclude="2012_0[1-9]" --exclude="2012_1[0-2]" --exclude="2013_0[1-"$(($tar_file_month-1))"]" 
    

当月是8月,tar_file_month变成了08,下面执行  $(($tar_file_month-1))的时候,变成了08-1,而0x对于shell来说,会解析成8进制,08超过了8进制的表示范围,所以报错:shell value too great for base;

解决方法:告诉shell使用10进制,加个10#

10#$tar_file_month-1

相关文章:

  • 2022-12-23
  • 2021-10-03
  • 2021-10-14
  • 2021-12-30
  • 2022-12-23
  • 2021-12-26
  • 2020-07-09
  • 2021-08-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2021-08-02
  • 2022-01-19
相关资源
相似解决方案