syntax error near unexpected token `then'问题的解决
来源:互联网 发布:住房转让软件 编辑:程序博客网 时间:2024/05/21 17:34
#!/bin/bash
#if program test
echo 'a:'
read a
if [ "$a" = "English" ];then
echo "right"
else
echo "wrong"
fi
结果执行时出现“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 `
- 主键和外键的作用
- qedit.h錯誤
- netstat -tlun
- 列表框的常用API
- 设计模式学习笔记——组合模式
- syntax error near unexpected token `then'问题的解决
- 关于中文
- CString字符串常用API
- Service Manager
- 身体锻炼习惯
- fzu 2140 Forever 0.5(推理)
- 关于做Android+JavaEE系统集成开发的一点心得
- Objective-c 中 nil, Nil, NULL和NSNull的区别
- 题目1059:abc