Search code examples
androidbashshelladbrecovery

Shell command 'ls' in Android fails: Syntax error: “(” unexpected


While I was testing my program in Android, my program crashed. After that, simple commands like 'ls', 'ps', 'grep', 'chmod' stopped working, and are throwing an exception: syntax error: '(' unexpected. Some do work, like 'pwd', 'stat' or 'cd'. For example:

@android:/ #  ls -l /bin/sh
 ls -l /bin/sh
/system/bin/ls[1]: syntax error: '(' unexpected

@android:/system/bin # ps | grep a
ps | grep a
/system/bin/ps[1]: syntax error: '(' unexpected
/system/bin/grep[1]: syntax error: '(' unexpected
@android:/ # pwd
pwd
/

I tried reboot and re-enter the developer option. Also tried to do factory data reset. it doesn't work. Does anybody know how to fix this?


Solution

  • You need to update or install new ROM. I had such case with cyanogen ROM. Update CM by settings->About->CyanogenMod update