【发布时间】:2013-11-20 14:45:04
【问题描述】:
我想在 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
【问题讨论】:
-
第一次检查可用选项
cut --help -
为问题添加了可用选项。
-
刚刚将busybox添加到线路中并且它可以工作。就像
cut --help不起作用,但busybox cut --help起作用。mount |grep -e /system|busybox cut -f 1 -d ' ' -
可能没有从
cut到busybox 的符号链接,或者您的搜索路径中首先出现了一些更原始的版本。