1 # Copyright (c) 2010, 2012, 2013, 2014
2 # Thorsten Glaser <tg@mirbsd.org>
3 # This file is provided under the same terms as mksh.
5 # Minimal /system/etc/mkshrc for Android
7 # Support: https://launchpad.net/mksh
10 : ${HOSTNAME:=$(getprop ro.product.device)}
11 : ${HOSTNAME:=android}
12 : ${MKSH:=/system/bin/sh}
15 : ${TMPDIR:=/data/local/tmp}
17 export HOME HOSTNAME MKSH SHELL TERM TMPDIR USER
19 if (( USER_ID )); then PS1='$'; else PS1='#'; fi
20 PS4='[$EPOCHREALTIME] '; PS1='${|
23 (( e )) && REPLY+="$e|"
26 }$USER@$HOSTNAME:${PWD:-?} '"$PS1 "
29 local -Uui16 -Z11 pos=0
30 local -Uui16 -Z5 hv=2147483647
33 cat "$@" | { set +U; if read -arN -1 line; then
36 while (( i < ${#line[*]} )); do
38 if (( (pos & 15) == 0 )); then
39 (( pos )) && print -r -- "$dasc|"
40 print -n "${pos#16#} "
44 if (( (hv < 32) || (hv > 126) )); then
49 (( (pos++ & 15) == 7 )) && print -n -- '- '
51 while (( pos & 15 )); do
53 (( (pos++ & 15) == 7 )) && print -n -- '- '
55 (( hv == 2147483647 )) || print -r -- "$dasc|"
60 eval export "\"$1\""'="$2"'
64 [[ -d $p/. ]] || continue
65 [[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH
70 : place customisations above this line