【发布时间】:2014-10-09 12:40:16
【问题描述】:
我正在尝试在 adb shell 上运行 linux shell 脚本。它给出了错误! 这是整个故事:
我写了一个简单的 bash 脚本 hello.sh :
#!/bin/bash
function hello
{
echo "hello world!"
}
hello
以 ./hello.sh 运行它会产生 o/p
hello world!
现在我将文件推送到 android 设备使用
adb push hello.sh /data/folder_name
然后运行以下命令进入 adb shell
adb shell
在 adb shell 中触发以下命令
cd /data/folder_name
chmod 755 hello.sh
sh hello.sh
这是我在 adb shell 上得到的:
# sh hello.sh
sh hello.sh
function: not found
hello world!
hello: not found
#
这里发生了什么! 还是有一些不同的方法来为 adb shell 脚本编写函数
我搜索但没有得到正确的解决方案 请帮忙。
【问题讨论】: