我想在adb中修剪一个字符串。 如果我写busybox --help它会将cut和sed列为可用命令。
mount |grep -e /system
有效,但
mount |grep -e /system| cut -f 1 -d ' '
不起作用。 android的busybox中有一个特殊的语法吗? 我也试过
echo "Hello World"|cut -f 1 -d ' '
从联机帮助页,它不起作用..
root@android:/ # busybox cut --help
busybox cut --help
BusyBox v1.21.1-Stericson (2013-07-08 15:58:11 BST) multi-call binary.
Usage: cut [OPTIONS] [FILE]...
Print selected fields from each input FILE to stdout
-b LIST Output only bytes from LIST
-c LIST Output only characters from LIST
-d CHAR Use CHAR instead of tab as the field delimiter
-s Output only the lines containing delimiter
-f N Print only these fields
-n Ignored
答案 0 :(得分:1)
为了使busybox
小程序以您期望的方式工作,您需要首先创建适当的符号链接:
$ adb shell whence sed
$ adb shell sed
/system/bin/sh: sed: not found
$ adb root
$ adb remount
remount succeeded
$ adb shell whence busybox
/system/bin/busybox
$ adb shell ln -s /system/bin/busybox /system/bin/sed
$ adb shell whence sed
/system/bin/sed
$ adb shell sed
Usage: sed [-efinr] SED_CMD [FILE]...
或者只做mount | grep -e /system | busybox cut -f 1 -d ' '