packages: mksh/mksh-mkshrc Applied fixes/suggestions from mksh maintainer: ...
arekm
arekm at pld-linux.org
Tue Nov 22 22:22:19 CET 2011
Author: arekm Date: Tue Nov 22 21:22:19 2011 GMT
Module: packages Tag: HEAD
---- Log message:
Applied fixes/suggestions from mksh maintainer:
21:36 <mirabilos> replace `id -u` with $USER_ID
21:36 <mirabilos> it's set by mksh
21:36 <mirabilos> and PLEASE do not use `
21:36 <mirabilos> especially as one cannot reliably use quotes inside it
21:37 <mirabilos> line 30-39 are also obsolete (in fact, dangerous)
(refering to keyboard binding)
22:11 <mirabilos> you could use [[ (and (( for the USER_ID comparison)
22:11 <mirabilos> that would save some ""
22:11 <mirabilos> the echo argument could use some "" though
22:12 <mirabilos> and it was agreed among shell developers that default configs SHOULD NOT export PS1
---- Files affected:
packages/mksh:
mksh-mkshrc (1.2 -> 1.3)
---- Diffs:
================================================================
Index: packages/mksh/mksh-mkshrc
diff -u packages/mksh/mksh-mkshrc:1.2 packages/mksh/mksh-mkshrc:1.3
--- packages/mksh/mksh-mkshrc:1.2 Thu Jul 7 16:43:46 2011
+++ packages/mksh/mksh-mkshrc Tue Nov 22 22:22:14 2011
@@ -1,51 +1,32 @@
# For interactive shell
# PROMPT
-if [ `id -u` -eq 0 ]; then
- PS1='[${LOGNAME-$USER}@${HOSTNAME} `
- if [ "$PWD" = "$HOME" ]; then
- echo "~";
- elif [ "$PWD" = "/${PWD##*/}" ]; then
- echo $PWD;
- else
- echo ${PWD##*/};
- fi`]# '
+PS1='[${LOGNAME-$USER}@${HOSTNAME} $(
+if [[ $PWD = "$HOME" ]]; then
+ echo "~"
+elif [[ $PWD = "/${PWD##*/}" ]]; then
+ print -r -- "$PWD"
else
- PS1='[${LOGNAME-$USER}@${HOSTNAME} `
- if [ "$PWD" = "$HOME" ]; then
- echo "~";
- elif [ "$PWD" = "/${PWD##*/}" ]; then
- echo $PWD;
- else
- echo ${PWD##*/};
- fi`]$ '
+ print -r -- "${PWD##*/}"
+fi)]'
+if (( USER_ID == 0 )); then
+ PS1+='# '
+else
+ PS1+='$ '
fi
-export PS1
# EDITING FUNCTIONS
set -o emacs
-bind '^I'=complete >/dev/null 2>&1
bind '^I'=complete-list >/dev/null 2>&1
-case $TERM in
- nxterm|xterm*|konsole*)
- bind '^[[H'=beginning-of-line >/dev/null 2>&1
- bind '^[[F'=end-of-line >/dev/null 2>&1
- ;;
- linux|rxvt*)
- bind '^[[1~'=beginning-of-line >/dev/null 2>&1
- bind '^[[4~'=end-of-line >/dev/null 2>&1
- ;;
-esac
-
# SYSTEM WIDE ALIASES ETC.
-if [ "`echo /etc/shrc.d/*.sh`" != "/etc/shrc.d/*.sh" ]; then
- for i in /etc/shrc.d/*.sh ; do
- . $i
- done
- unset i
-fi
+for i in /etc/shrc.d/*.sh; do
+ [[ -e $i ]] || continue
+ . "$i"
+done
+unset i
HISTFILE=~/.history.mksh
# vi:syntax=sh
+
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mksh/mksh-mkshrc?r1=1.2&r2=1.3&f=u
More information about the pld-cvs-commit
mailing list