自定义adb提示

时间:2014-03-25 05:11:58

标签: android adb

如何在adb shell打开shell的提示之前减少打印路径的长度?我的问题是它太长了以至于我再也看不到我的命令了,因为它不会自动断行。我更喜欢当前目录的名称或抽象代码示例。

Android手机上的

sh -v给了我

# Copyright (c) 2010
#   Thorsten Glaser <t.glaser@tarent.de>
# This file is provided under the same terms as mksh.
#-
# Minimal /system/etc/mkshrc for Android

: ${TERM:=vt100} ${HOME:=/data} ${MKSH:=/system/bin/sh} ${HOSTNAME:=android}
: ${SHELL:=$MKSH} ${USER:=$(typeset x=$(id); x=${x#*\(}; print -r -- ${x%%\)*})}
if (( USER_ID )); then PS1='$'; else PS1='#'; fi
function precmd {
    typeset e=$?

    (( e )) && print -n "$e|"
}
PS1='$(precmd)$USER@$HOSTNAME:${PWD:-?} '"$PS1 "
export HOME HOSTNAME MKSH PS1 SHELL TERM USER
alias l='ls'
alias la='l -a'
alias ll='l -l'
alias lo='l -a -l'

for p in ~/.bin; do
    [[ -d $p/. ]] || continue
    [[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH
done

unset p

: place customisations above this line

1 个答案:

答案 0 :(得分:4)

您可以使用以下行更改PS1提示:

PS1="> "

但最好用以下方式增加窗口宽度:

COLUMNS=150
相关问题