此错误是shell脚本在计算以0开头的数字时,默认以8进制进行计算,导致在计算08时超过了8进制的范围,报此错误。

shell脚本代码如下:

#!/bin/bash
a=
for i in {..}
do
a=$[$a+]
if [ $a -lt ]
then
a=""$a
fi
echo "$a"
done

运行之后的结果:


t.sh: line : : value too great for base (error token is "")

解决方法:使用10#将该变量声明为10进制。

如下代码即可成功运行。

a=
for i in {..}
do
a=$[10#$a+]
if [ $a -lt ]
then
a=""$a
fi
echo "$a"
done

shell脚本报错 value too great for base的更多相关文章

  1. shell脚本报错退出

    在shell脚本中,比如有以下的代码: cd /root/test88 rm -rf  backup 如果目录/root/test88不存在,脚本不会停止,依然会执行rm -rf backup这个命令 ...

  2. Shell脚本报错--syntax error near unexpected token for((i=0;i<$length;i++))

    现象: shell脚本使用Nodepad++进行本地编辑,在编辑后上传到linux机器进行执行时提示“syntax error near unexpected token for((i=0;i< ...

  3. linux shell脚本报错总结

    1  rizhi.sh: line 28: warning: here-document at line 9 delimited by end-of-file (wanted `EOF') 原因是末尾 ...

  4. 运行shell脚本报错 &#39;\357\273\277&#39;: command not found 解决的方法

    1,删除BOM,在vi以下运行以下的命令就可以 :set nobomb 2,原因: 所谓BOM,全称是Byte Order Mark.它是一个Unicode字符,通常出如今文本的开头,用来标识字节序( ...

  5. Shell 脚本报错 line x: [xxx: command not found

    [root@VM-0-6-centos sh_scripts]# bash val.sh username: hello world! val.sh: line 5: [hello: command ...

  6. 运行shell脚本时报错"[[ : not found"解决方法

    问题描述 在运行shell脚本时报错,命令为: sh test.sh 报错如图: 脚本代码如下: #!/bin/bash # file:test.sh # author:13 # date:2017- ...

  7. hbase shell 启动报错

    启动hbase之后,发现hbase shell启动报错: version 2.0.0-alpha4, r5c4b985f89c99cc8b0f8515a4097c811a0848835, Tue Oc ...

  8. 调用python脚本报错/usr/bin/env: python : No such file or directory

    一.调用python脚本报错 /usr/bin/env: python: No such file or directory 二.解决方法 原因是在windows上编写的脚本,使用dos2unix对脚 ...

  9. shell编程报错:“syntax error near unexpected token `”

    今天写了个shell脚本,在自己机器上运行正常,给同事,运行报错syntax error near unexpected token `,左看右看shell脚本没有问题,没有办法google搜索,发现 ...

随机推荐

  1. php面向对象编程_1

    1, php面向对象编程的三大特征: (1) 封装性,封装就是把抽象出的数据和对数据的操作封装在一起,数据被保护在内部,程序的其它部分只有通过被授权的操作(成员方法)才能对数据进行操作. (2) 继承 ...

  2. [Flex] 组件Tree系列 —— 将数组作为dataProvider

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:将数组作为dataProvider ...

  3. AOP拦截日志报错llegalStateException: It is illegal to call this method if the current request is not in asynchronous mode

    原文链接:https://my.oschina.net/mengzhang6/blog/2395893 关于一次AOP拦截入参记录日志报错的梳理总结 将服务发布到tomcat中后,观察服务的运行状态以 ...

  4. 重载<<运算符第二个参数必须加上const

    如题,在重载<<时不停的报错,说找不到匹配的函数,仔细观察和书上的样例对比后发现,我的第二个参数缺少了一个const,抱着试一试的心态,因为平时也没注意const这个东西,也不经常用,试了 ...

  5. [inside hotspot] 汇编模板解释器(Template Interpreter)和字节码执行

    [inside hotspot] 汇编模板解释器(Template Interpreter)和字节码执行 1.模板解释器 hotspot解释器模块(hotspot\src\share\vm\inter ...

  6. Jquery sblings

    $("给定元素").siblings(".selected") 中的(".selected")表示筛选给定元素类名为.selected的同胞 ...

  7. c# Config配置文件读写

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.C ...

  8. iis+php(FastCGI)

    1. 安装 IIS 时选择添加 CGI 功能 2. 安装 PHP, 2.1 下载 nts 版本 (非线程安全版本) zip 压缩包,下载对应的 vc++ 运行时(php官网下载页面左侧有下载链接) 2 ...

  9. 数据库SQL(1)

    EG1:db.LpOutputGroups.GroupBy(q => q.CalcGroupDesc).ToList().OrderByDescending(m => m.First(). ...

  10. Python学习 day12

    一.@wraps __name__    查看函数的名字 __doc__   查看函数的文档字符串 例: def func(arg): """ 这是一个测试函数,这里是函 ...