无法运行在bash脚本命令ADB脚本、命令、bash、ADB

2023-09-06 09:09:41 作者:这朵云好调皮

我试图从亚行的shell推出A​​ndroid绑定设置。这样做的主要目的是通过运行一个shell脚本来启用USB绑定模式。我用下面一组在我的Ubuntu终端(12.04)的命令:

 亚行外壳我开始-n com.android.settings / .TetherSettings睡眠7输入抽头162 159输入抽头385 607 

在执行上述命令逐个这种方法工作得很好,但我不能够运行它们正常的shell脚本。请帮忙!下面是完整的脚本:

 #!/ bin / sh的亚行的shell我开始-n com.android.settings / .TetherSettings睡眠7输入抽头162 159输入抽头385 607 

我想,它无法找到在我的系统,以亚行的路径。我试过的实际路径在SDK目录ADB工具取代了第一道防线。这也不起作用。任何工作都围绕这个?(很抱歉,如果这个问题似乎很傻。我真的很新bash脚本编程!)

编辑:更新后的脚本: -

 #!/ bin / sh的CD /家庭/ evinish /文档/ Android的/ ADT-束Linux的x86_64-20130219 / SDK /平台的工具亚行壳我开始-n com.android.settings / .TetherSettings睡眠7输入抽头162 159输入抽头385 607 
iis6手工创建网站后无法运行php脚本的解决方法

解决方案

谢谢大家!我终于解决了这个问题。以下是更新后的脚本:

 #!/ bin / sh的CD /家庭/ evinish /文档/ Android的/ ADT-束Linux的x86_64-20130219 / SDK /平台的工具./adb设备./adb壳我开始-n com.android.settings / .TetherSettings睡眠15输入抽头162 159输入抽头385 607睡眠10 

唯一的问题是亚行前失踪./。

I'm trying to launch Android tethering settings from adb shell. The main purpose of doing so is to enable USB tethering mode by running a shell script. I'm using the following set of commands on my Ubuntu Terminal (12.04):

adb shell
am start -n com.android.settings/.TetherSettings
sleep 7
input tap 162 159
input tap 385 607

This method works fine when the commands are executed one by one, but I'm not able to run them as normal shell script. Please help! Here is the complete script:

#!/bin/sh
adb shell
am start -n com.android.settings/.TetherSettings
sleep 7
input tap 162 159
input tap 385 607

I guess, it can't find the path to adb in my system. I've tried replacing the first line with the actual path to adb tool in SDK directory. That didn't work either. Any work around for this? (Sorry if the question seems silly. I'm really new to bash scripting!)

EDIT: Updated script:-

#!/bin/sh
cd /home/evinish/Documents/Android/adt-bundle-linux-x86_64-20130219/sdk/platform-tools
adb shell "
am start -n com.android.settings/.TetherSettings
sleep 7
input tap 162 159
input tap 385 607
"

解决方案

Thanks everybody! I finally solved the problem. Here is the updated script:

#!/bin/sh
cd /home/evinish/Documents/Android/adt-bundle-linux-x86_64-20130219/sdk/platform-tools
./adb devices
./adb shell "
am start -n com.android.settings/.TetherSettings
sleep 15
input tap 162 159
input tap 385 607
"
sleep 10

The only problem was missing "./" before adb.