syntax error near unexpected token `then'问题的解决
来源:互联网 发布:python工具 量化交易 编辑:程序博客网 时间:2024/05/21 09:50
#!/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 `
- hdu 5090 Game with Pearls(最大匹配)
- C语言分割字符串
- An Introduction to Interactive Programming in Python(week 6)
- wor_queue相关函数
- Handler源码认知
- syntax error near unexpected token `then'问题的解决
- 可做刮刮卡的图像擦除插件jQuery eraser
- 多线程同步一例
- 19.abstract class和interface有什么区别?
- Python模块的定义
- Android 4.3 安全提升,Set-UID-Root 权限提升不再起作用,原先的ROOT方法将失效
- hexdump的用法
- 为什么唱吧iOS 6.0选择了Mantle
- 【C++】谈谈类定义里的this指针