请帮助我“binary operator expected in cygwin” [英] Please Help me "binary operator expected in cygwin"

查看:317
本文介绍了请帮助我“binary operator expected in cygwin”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Cygwin中运行Shell脚本,但我得到下面的错误msgs:

I am trying to Run Shell script in Cygwin but I am getting Following error msgs:

app.sh:line 215:clear:command not found
[:scripts / Test:二进制运算符。
文件夹脚本/测试ID未找到...

app.sh: line 215: clear: command not found [: scripts/Test: binary operator expected. The folder scripts/Test ID Not found...

任何人建议。什么是问题我需要重新安装Cygwin。

Can Any one suggest. What is the problem Do i need to re install Cygwin again.

因为同样的脚本在Linux环境中运行良好。

Because Same Script Running fine in the Linux Envirnment.

感谢在进阶.....

Thanks in Advance.....

推荐答案

脚本可能是使用#!/ bin / sh期望/ bin / bash的行为。尝试执行脚本:/ bin / bash shell_script.sh

the script is probably using '#!/bin/sh' but expects the behaviour of /bin/bash. Try executing the script as: /bin/bash shell_script.sh

调试工具包括使用-x选项执行脚本,即bash -x shell_script.sh。从开始的问题看起来像一个未设置的变量,正在检查使用不受保护的形式:

debugging tools include executing the script with the -x option, i.e. bash -x shell_script.sh. The problem from the outset looks like an unset variable that is being checked using the unprotected form:

if [ $x = ]

问题是如果$ x未设置,那么你最终会得到一个空令牌,脚本失败。

the problem is that if $x is unset, then you end up with an empty token, which causes the script to fail.

对于未找到明确的clear命令,cygwin的实现是调用'tput clear' 'tput clear',那么它应该工作。

for the explicit 'clear' command not found, the cygwin implementation of that is to call 'tput clear' if you replace the 'clear' call with 'tput clear' then it should work.

这篇关于请帮助我“binary operator expected in cygwin”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆