system/core
Revision | 96f009c218ff8aa9c63ce2d95c740b839a7af3f2 (tree) |
---|---|
Zeit | 2011-06-20 04:08:48 |
Autor | Thorsten Glaser <tg@mirb...> |
Commiter | Thorsten Glaser |
update mkshrc in sync with upstream dot.mkshrc sample file
• add a pager, called “more” here (“smores” upstream)
• no longer export PS1 (problem spotted by Frank Terbeck)
Change-Id: I69491de5ba5c9f39497f0736bd76abb113ba29d1
@@ -1,4 +1,4 @@ | ||
1 | -# Copyright (c) 2010 | |
1 | +# Copyright (c) 2010, 2011 | |
2 | 2 | # Thorsten Glaser <t.glaser@tarent.de> |
3 | 3 | # This file is provided under the same terms as mksh. |
4 | 4 | #- |
@@ -13,12 +13,29 @@ function precmd { | ||
13 | 13 | (( e )) && print -n "$e|" |
14 | 14 | } |
15 | 15 | PS1='$(precmd)$USER@$HOSTNAME:${PWD:-?} '"$PS1 " |
16 | -export HOME HOSTNAME MKSH PS1 SHELL TERM USER | |
16 | +export HOME HOSTNAME MKSH SHELL TERM USER | |
17 | 17 | alias l='ls' |
18 | 18 | alias la='l -a' |
19 | 19 | alias ll='l -l' |
20 | 20 | alias lo='l -a -l' |
21 | 21 | |
22 | +function more { | |
23 | + typeset dummy line llen curlin=0 | |
24 | + | |
25 | + cat "$@" | while IFS= read -r line; do | |
26 | + llen=${%line} | |
27 | + (( llen == -1 )) && llen=${#line} | |
28 | + (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 )) | |
29 | + if (( (curlin += llen) >= LINES )); then | |
30 | + print -n -- '\033[7m--more--\033[0m' | |
31 | + read -u1 dummy | |
32 | + [[ $dummy = [Qq]* ]] && return 0 | |
33 | + curlin=$llen | |
34 | + fi | |
35 | + print -r -- "$line" | |
36 | + done | |
37 | +} | |
38 | + | |
22 | 39 | for p in ~/.bin; do |
23 | 40 | [[ -d $p/. ]] || continue |
24 | 41 | [[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH |