<分区>
我正在尝试在 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 脚本编写函数
我搜索过但没有找到合适的解决方案 请帮忙。