]> git.pld-linux.org Git - packages/mksh.git/commitdiff
Applied fixes/suggestions from mksh maintainer:
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Tue, 22 Nov 2011 21:22:14 +0000 (21:22 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
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

Changed files:
    mksh-mkshrc -> 1.3

mksh-mkshrc

index e15906dcc5381aa9fd780f2346304460657e0437..1efd688824eb72c3b8416bfed78cc05b68ecedc5 100644 (file)
@@ -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
+
This page took 0.03118 seconds and 4 git commands to generate.