Skip to content
Advertisement

Shell script works in bash but not on ‘adb shell’

Below shell script works perfectly fine in bash shell. But produces an error in android shell. May be it has got to do something with the shell that android is using. But how can I resolve it? If not a perfect solution, an hack would also do for me.

Shell-script :

JavaScript

O/p In android shell,

JavaScript

O/p on bash shell(Linux):

JavaScript

Advertisement

Answer

When the value of $x is just =, it looks like:

JavaScript

and it’s apparently getting confused by the = that should be a value rather than an operator.

Change it to:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement