我一直在尝试写一个脚本来强化android。我没有成功过!
我正在通过仿真器运行AVD,并尝试使用android shell和我加载的bash shell。脚本很简单,您将在下面看到,每个命令都可以独立运行,但在脚本中,它只是运行得太快了。
我知道在顶部没有shebang,但这是因为我插入了一个错误。
我的脚本是:
echo ANDROID
echo HARDENING STARTED
device=/dev/block/mtdblock0
mount -o rw,remount $device /system
#removing files in the /system/xbin directory
rm /system/xbin/tcpdump
rm /system/xbin/su
#removing files in the /system/bin directory
rm /system/bin/bootanimation
rm /system/bin/dumpstate
rm /system/bin/ping
rm /system/bin/ping6
echo ANDROID
echo HARDENING COMPLETE我已经删除了所有缩进,因为我认为这可能是导致错误的原因,并且目录和文件肯定存在。我已经用了三天了,感觉很虚弱。
我在开始时有一个if语句来选择其他手机上的设备,但为了减少错误,我去掉了这个语句(这就是为什么我声明device而不是mounting)。
下面是错误:
ANDROID
HARDENING STARTED
mount: no such file or directory exist
, no such file or directorytcpdump
, no such file or directorysu
, no such file or directoryootanimation
, no such file or directoryumpstate
, no such file or directorying
, no such file or directorying6
ANDROID
HARDENING COMPLETED注意合并后的目录,这不是一个拼写错误。
谢谢,瑞恩
发布于 2013-01-16 21:46:51
您在Windows系统上编辑了此文件,它具有DOS样式的行尾(<cr><lf>)。将其转换为使用Unix风格的行尾标记(<lf>),它应该可以很好地工作。任何一个好的程序员的编辑器都有能力为你做到这一点,或者你可以使用do it using standard command line tools。
顺便说一句,shell根本不关心缩进。这一点:
echo Hello
echo world.与以下内容相同:
echo Hello
echo world.发布于 2013-08-12 09:56:36
将行尾改为Unix样式,将解决您所有的问题。
https://stackoverflow.com/questions/14359771
复制相似问题