1# Copyright (c) 2010, 2012, 2013 2# Thorsten Glaser <tg@mirbsd.org> 3# This file is provided under the same terms as mksh. 4#- 5# Minimal /system/etc/mkshrc for Android 6# 7# Support: https://launchpad.net/mksh 8 9: ${TERM:=vt100} ${HOME:=/data} ${MKSH:=/system/bin/sh} ${HOSTNAME:=$(getprop ro.product.device)} 10: ${SHELL:=$MKSH} ${USER:=$(typeset x=$(id); x=${x#*\(}; print -r -- ${x%%\)*})} ${HOSTNAME:=android} 11if (( USER_ID )); then PS1='$'; else PS1='#'; fi 12function precmd { 13 typeset e=$? 14 15 (( e )) && print -n "$e|" 16} 17PS1='$(precmd)$USER@$HOSTNAME:${PWD:-?} '"$PS1 " 18export HOME HOSTNAME MKSH SHELL TERM USER 19alias l='ls' 20alias la='l -a' 21alias ll='l -l' 22alias lo='l -a -l' 23 24function hd { 25 cat "$@" | command hd /proc/self/fd/0 26} 27 28function more { 29 local dummy line llen curlin=0 30 31 cat "$@" | while IFS= read -r line; do 32 llen=${%line} 33 (( llen == -1 )) && llen=${#line} 34 (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 )) 35 if (( (curlin += llen) >= LINES )); then 36 print -n -- '\033[7m--more--\033[0m' 37 read -u1 dummy 38 [[ $dummy = [Qq]* ]] && return 0 39 curlin=$llen 40 fi 41 print -r -- "$line" 42 done 43} 44 45function setenv { 46 eval export "\"$1\""'="$2"' 47} 48 49for p in ~/.bin; do 50 [[ -d $p/. ]] || continue 51 [[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH 52done 53 54unset p 55 56: place customisations above this line 57