Reputation: 43
I am getting error while executing the below command:
$ sudo adb shell ping `cat /data/my_address.pst`
Where my_adress.pst file contains the ip address.
But the same command works fine when executed from the shell.
$ sudo adb shell
$ ping `cat /data/my_address.pst`
How can i pass executable commands like this? please throw some light on this.
Thanks.
Upvotes: 1
Views: 1791
Reputation: 31676
Your cat /data/my_address.pst
command gets executed by local shell so you need to escape the backticks or single quote the whole command. Also you do not need sudo
and use of $()
is preferable over backticks:
adb shell 'ping $(cat /data/my_address.pst)'
Upvotes: 1
Reputation: 25873
Escape the ` so it is not interpreted by the shell.
adb shell ping \`cat /data/my_address.pst\`
Upvotes: 1