title: Customize adb prompt
body: <p>How can I reduce the length of the path printed before the prompt of the shell opened by <code>adb shell</code>? My problem is that it is so long that I can no longer see my commands because the doesn't break the line automatically. I would prefer something like the name of the current directory or an abstract code example.</p>
  
  <p><code>sh -v</code> on Android phone gives me </p>
  
  <pre><code># Copyright (c) 2010
  #   Thorsten Glaser &lt;t.glaser@tarent.de&gt;
  # 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 )) &amp;&amp; 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
  </code></pre>