Search code examples
linuxcygwin

Please Help me "binary operator expected in cygwin"


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: binary operator expected. The folder scripts/Test ID Not found...

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

Because Same Script Running fine in the Linux Envirnment.

Thanks in Advance.....


Solution

  • the script is probably using '#!/bin/sh' but expects the behaviour of /bin/bash. Try executing the script as: /bin/bash 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 = ]
    

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

    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.