2013-11-20 2 views
0

절단 또는 sed를 사용하여. busybox --help을 쓰면 사용 가능한 명령으로 cut 및 sed가 나열됩니다.은 내가 ADB의 문자열을 다듬을 안드로이드 비지 박스

mount |grep -e /system 

작동하지만

mount |grep -e /system| cut -f 1 -d ' ' 

이 작동하지 않습니다. 안드로이드의 busybox에 특별한 구문이 있습니까? 나는 또한 맨 페이지에서

echo "Hello World"|cut -f 1 -d ' ' 

을 시도하고 작동하지 않습니다 ..

[email protected]:/ # 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 채널을 사용할 수있는 옵션'cut --help'를 사용하여 –

+0

옵션에 질문을 추가하십시오. – PdXY

+0

라인에 busybox를 추가하기 만하면 작동합니다. 그것은 가'--help' 이 작동하지 않습니다 잘라와 동일하지만 '비지 박스는 --help' 가하는 잘라. '마운트는 | 그렙 -e/시스템 | 비지 박스는 -f 1 -d '' ' – PdXY

답변

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 ' '

+0

네, 제 코멘트에서 언급했듯이 오류는 실제로 심볼릭 링크가 없었습니다. "sed"또는 "cut"을 입력 할 때 오류가 없었기 때문에 깨닫지 못했습니다. 명령을 찾았고 인수 목록을 받았습니다. 여전히 별칭이 아닌 busybox 명령을 사용해야했습니다. 도와 줘서 고마워! – PdXY