syntax error near unexpected token `then'问题的解决
来源:互联网 发布:淘宝女装英文店名 编辑:程序博客网 时间:2024/05/20 00:15
#!/bin/bash
#if program test
echo 'a:'
read a
if [ "$a" = "English" ];then
echo "right"
else
echo "wrong"
fi
我是按照视频上的程序稍作修改写的shell脚本程序,结果执行时出现“syntax error near unexpected token `then'”,看半天没看出原因,上网查了半天,终于搞明白了原因:if 与‘['之间没有加空格导致的。另外,在执行时,我也发现 ‘=’两边必须也得加空格,否则也会出错,不是语法出错,而是不管赋给a的值是多少,程序都会得到if 后面的语句为假,从而得出wrong的情况。
0 0
- syntax error near unexpected token `then'问题的解决
- syntax error near unexpected token `then'问题的解决
- syntax error near unexpected token `then'问题的解决
- syntax error near unexpected token `then'问题的解决
- syntax error near unexpected token `then'问题的解决
- syntax error near unexpected token `then'问题的解决
- shell script中的syntax error near unexpected token `then' 问题
- syntax error near unexpected token `问题的解决
- 错误:syntax error near unexpected token `then'
- syntax error near unexpected token `then'
- “syntax error near unexpected token `then'”错误
- syntax error near unexpected token `then'
- 解决cygwin中的 syntax error near unexpected token问题
- syntax error near unexpected token ?怎么解决
- 解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
- linux shell脚本syntax error near unexpected token `then'
- shell if else 用法 syntax error near unexpected token `then'
- syntax error near unexpected token `
- 面试题:HashMap HashTable ConcurrentHashMap区别
- 我的回忆
- apache mina
- Java 生成文件MD5算法
- 一般图匹配带花树
- syntax error near unexpected token `then'问题的解决
- 学习
- Storm运行出现Client is being closed, and does not take requests any more引起的Netty故障跟踪
- oschina安卓源代码解析(四)构造新闻实体类
- Handler引起的内存泄露(Activity中Handler的正确使用方法)
- 内存管理和内存池(转载两篇博客)
- 在LaTeX里插入全页的pdf
- IntelliJ IDEA中显示行号的方法
- USACO5.1.1 Fencing the Cows(fc)