I'm trying to run a script on the Nox emulator through adb. After connecting to Nox via adb with
adb connect localhost:62001 and copying a script into a
/data/scripts/script.sh folder, executing it gives me different outputs. The script contains the following:
#!/system/bin/sh dd if="/data/scripts/screen.dump" bs=4 skip=540503 count=1 | hd # Expected output: 00000000 08 04 1D FF
Now, here is the problem: I'm getting different results depending where/how I run the script. For it to work, I need to open the shell first with
adb shell, and any of the following commands work from within it:
dd if="/data/scripts/screen.dump" bs=4 skip=540503 count=1 | hd
But I need to be able to run the commands from within a script without having to type them. All of these don't work:
adb shell sh ./data/scripts/script.sh
adb shell . ./data/scripts/script.sh
adb shell 'dd if="/data/scripts/screen.dump" bs=4 skip=540503 count=1 | hd'
The main error I'm getting is
Usage: hd [-b base] [-c count] [-r delay] file (which is weird because I know it's correct), and occasionally also
dd: stdout: Broken pipe. I've spent about 5 hours today trying only to solve this and I'm out of ideas... If anyone has one let me know!