[Android-development] Complicated adb command help

Jason H jhihn at gmx.com
Tue Oct 1 16:14:00 CEST 2019


Ironically I got ti to work in linux by using the "windows" version: https://stackoverflow.com/a/29357619/8259820

> Sent: Monday, September 30, 2019 at 7:15 PM
> From: "Jason H" <jhihn at gmx.com>
> To: android-development at lists.qt-project.org
> Subject: [Android-development] Complicated adb command help
>
> I'm trying to get the IMEI from ADB:
> abd shell 'service call iphonesubinfo 1 | grep -o "[0-9a-f]\{8\} " | tail -n+3| while read a; do echo -n "\u${a:4:4}\u${a:0:4}"; done ;echo'
> This works at the command line, (save any typos), but I cannot get it to work with QProcess. I've tried it as new QProcess()->start(command) as well as ->setProgram(adb); ->setArguments(QStringList {
>  "shell", "-x", "'service call iphonesubinfo 1 | grep -o \"[0-9a-f]\\{8\\} \" | tail -n+3| while read a; do echo -n \"\\u${a:4:4}\\u${a:0:4}\"; done ;echo'"
> });
>
> and several other permutations. Does anyone know what is going on?
> The closest I got was:
> /system/bin/sh: service call iphonesubinfo 1 | grep -o "[0-9a-f]\{8\} " | tail -n+3| while read a; do echo -n "\u${a:4:4}\u${a:0:4}"; done ;echo: not found
>
> I've gotten other various not founds, like for grep. Can't seem to get the \ or " ' right. I got it to print the right command on the line as an error, executing it in adb shell worked.
>
> Many thanks in advance!
>
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> https://lists.qt-project.org/listinfo/android-development
>


More information about the Android-development mailing list