[Midnightbsd-cvs] src: dot.mkshrc: update dot.mkshrc for the new version
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Wed Mar 25 12:08:51 EDT 2009
Log Message:
-----------
update dot.mkshrc for the new version
Modified Files:
--------------
src/share/skel:
dot.mkshrc (r1.3 -> r1.4)
-------------- next part --------------
Index: dot.mkshrc
===================================================================
RCS file: /home/cvs/src/share/skel/dot.mkshrc,v
retrieving revision 1.3
retrieving revision 1.4
diff -L share/skel/dot.mkshrc -L share/skel/dot.mkshrc -u -r1.3 -r1.4
--- share/skel/dot.mkshrc
+++ share/skel/dot.mkshrc
@@ -1,53 +1,20 @@
# $MidnightBSD$
-# $MirOS: src/bin/mksh/dot.mkshrc,v 1.31 2008/04/11 20:14:02 tg Rel $
+# $MirOS: src/bin/mksh/dot.mkshrc,v 1.39 2008/12/13 17:09:45 tg Rel $
#-
-# Copyright (c) 2007, 2008
-# Thorsten “mirabilos” Glaser <tg at mirbsd.de>
-#
-# Provided that these terms and disclaimer and all copyright notices
-# are retained or reproduced in an accompanying document, permission
-# is granted to deal in this work without restriction, including un-
-# limited rights to use, publicly perform, distribute, sell, modify,
-# merge, give away, or sublicence.
-#
-# Advertising materials mentioning features or use of this work must
-# display the following acknowledgement:
-# This product includes material provided by Thorsten Glaser.
-#
-# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
-# the utmost extent permitted by applicable law, neither express nor
-# implied; without malicious intent or gross negligence. In no event
-# may a licensor, author or contributor be held liable for indirect,
-# direct, other damage, loss, or other issues arising in any way out
-# of dealing in the work, even if advised of the possibility of such
-# damage or existence of a defect, except proven that it results out
-# of said person's immediate fault when using the work as intended.
-#-
-# sample mksh initialisation file for interactive shells; install as
-# /etc/skel/.mkshrc (as root, for new accounts) or copy to ~/.mkshrc
+# ~/.mkshrc: mksh initialisation file for interactive shells
: ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(ulimit -c 0;hostname -s 2>&-)}
[[ $HOSTNAME = @(localhost|*([ ])) ]] && HOSTNAME=$(ulimit -c 0;hostname 2>&-)
-: ${HOSTNAME:=nil}; PS1='#'; [[ "$(ulimit -c 0; id -u 2>&-)" -eq 0 ]] || PS1='$'
+: ${HOSTNAME:=nil}; if (( USER_ID )); then PS1='$'; else PS1='#'; fi
function precmd {
- typeset -Ui10 e=$?
+ typeset -i e=$?
(( e )) && print -n "$e|"
}
-PS1='$(precmd)${USER:=$(ulimit -c 0;id -un 2>&- || print \?)}@${HOSTNAME%%.*}:$(
- typeset pfx=~ wd=${PWD:-?}
- typeset -Ui n=${COLUMNS:-80}/3; (( n = n < 7 ? 7 : n ))
- wd=${wd/#$pfx/~}
- pfx=; while (( (${#pfx} + ${#wd}) > n )); do
- if [[ $wd = */* ]]; then
- pfx=.../
- wd=${wd#*/}
- else
- pfx=...
- wd=${wd#?????}
- fi
- done; print -nr -- "$pfx$wd") '"$PS1 "
-PS1="$(print -n '\x1\r')$PS1" # allow colour codes, framed with ^A
+PS1='
$(precmd)${USER:=$(ulimit -c 0;id -un 2>&-||print \?)}@${HOSTNAME%%.*}:$(
+ typeset p=~ d=${PWD:-?}; typeset -i n=${COLUMNS:-80}/3
+ [[ $p = ?(*/) ]] || d=${d/#$p/~}; (( n=n<7?7:n )); (( ${#d}>n )) && {
+ p=...; d=${d:(-n)}; } || p=; print -nr -- "$p$d") '"$PS1 "
export EDITOR HOSTNAME LESSHISTFILE=- MKSH=$(whence -p mksh) PS1 TERM USER
alias ls=ls
unalias ls
@@ -66,11 +33,12 @@
# Berkeley C shell compatible dirs, popd, and pushd functions
# Z shell compatible chpwd() hook, used to update DIRSTACK[0]
-DIRSTACKBASE=$(readlink -nf ~/. 2>&- || print -nr -- "$HOME")
+DIRSTACKBASE=$(realpath ~/. 2>&- || print -nr -- "$HOME")
set -A DIRSTACK
function chpwd {
- DIRSTACK[0]=$(readlink -nf . 2>&- || print -r -- "$PWD")
- DIRSTACK[0]=${DIRSTACK[0]/#$DIRSTACKBASE/~}
+ DIRSTACK[0]=$(realpath . 2>&- || print -r -- "$PWD")
+ [[ $DIRSTACKBASE = ?(*/) ]] || \
+ DIRSTACK[0]=${DIRSTACK[0]/#$DIRSTACKBASE/~}
:
}
chpwd .
@@ -91,7 +59,7 @@
typeset d
typeset -i isnoglob=0 fl=0 fv=0 fn=0 cpos=0
- [[ $(set +o) == *-o\ noglob* ]] && isnoglob=1
+ [[ $(set +o) == *@(-o noglob)@(| *) ]] && isnoglob=1
set -o noglob
while getopts ":lvn" d; do
case $d {
@@ -136,7 +104,7 @@
typeset d fa
typeset -i isnoglob=0 n=1
- [[ $(set +o) == *-o\ noglob* ]] && isnoglob=1
+ [[ $(set +o) == *@(-o noglob)@(| *) ]] && isnoglob=1
set -o noglob
while getopts ":0123456789lvn" d; do
case $d {
@@ -175,7 +143,7 @@
typeset d fa
typeset -i isnoglob=0 n=1
- [[ $(set +o) == *-o\ noglob* ]] && isnoglob=1
+ [[ $(set +o) == *@(-o noglob)@(| *) ]] && isnoglob=1
set -o noglob
while getopts ":0123456789lvn" d; do
case $d {
More information about the Midnightbsd-cvs
mailing list