Print this page
3395 add /etc/profile.d and /etc/.login.d
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/nsadmin/ksh.kshrc
+++ new/usr/src/cmd/nsadmin/ksh.kshrc
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21
22 22 #
23 23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
↓ open down ↓ |
25 lines elided |
↑ open up ↑ |
26 26
27 27 #
28 28 # This file is sourced by interactive ksh93 shells before ${HOME}/.kshrc
29 29 #
30 30
31 31 # Enable "gmacs"+"multiline" editor mode if the user did not set an
32 32 # input mode yet (for example via ${EDITOR}, ${VISUAL} or any
33 33 # "set -o" flag)
34 34 if [[ "$(set +o)" != ~(Er)--(gmacs|emacs|vi)( .*|) ]] ; then
35 35 set -o gmacs
36 - # enable multiline input mode
37 - set -o multiline
38 - # enable globstar mode (match subdirs with **/)
39 - set -o globstar
40 36 fi
37 +# enable multiline input mode
38 +set -o multiline
39 +# enable globstar mode (match subdirs with **/)
40 +set -o globstar
41 41
42 42 # Set a default prompt (<username>@<hostname>:<path><"($|#) ">) if
43 43 # then variable does not exist in the environment.
44 44 #
45 45 # Algorithm:
46 46 # 1. Define "ellipsis", either Unicode #2026 for unicode locales
47 47 # and "..." otherwise
48 48 # ([[ "${LC_ALL}/${LANG}" = ~(Elr)(.*UTF-8/.*|/.*UTF-8) ]]
49 49 # ensures that the pattern matches the leftmost sequence
50 50 # containing *.UTF-8, allowing to match either LC_ALL or
51 51 # LANG when LC_ALL is not set)
52 52 # 2. If PWD is within HOME replace value of HOME with '~'
53 53 # If the PWD is longer than 30 charatcers shorten it to 30 chars
54 54 # print '#' for user "root" and '$' for normal users
55 55 # Notes:
56 56 # - printf "%*s\r%s" COLUMNS "") # is used at the beginning to
57 57 # work around a bug in the "multiline" handling code which
58 58 # causes the shell to override its own prompt when the edit
59 59 # line overflows (this happens if the terminal cursor
60 60 # position is not 0 when PS1 is printed).
61 61 # - PS1 will initially be empty until either...
62 62 # a) ... someone sets the variable
63 63 # or
64 64 # b) ... the prompt is displayed for the first time (default is
65 65 # '$ ' for normal users and '# ' for user "root")
66 66 # - The statement below will not work if someone sources /etc/ksh.kshrc
67 67 # unless PS1 gets "unset" first.
68 68 # - Make sure to use absolute paths (e.g. /usr/bin/hostname) to make
69 69 # sure PS1 works in cases where PATH does not contain /usr/bin/
70 70 if [[ "$(set)" != ~(E)PS1= && "${PS1}" == '' ]] ; then
71 71 PS1='$(set +o xtrace +o errexit
72 72 printf "%*s\r%s" COLUMNS ""
73 73 printf "%s@%s:" "${LOGNAME}" "$(/usr/bin/hostname)"
74 74 ellip="${
75 75 [[ "${LC_ALL}/${LANG}" == ~(Elr)(.*UTF-8/.*|/.*UTF-8) ]] &&
76 76 printf "\u[2026]\n" || print "..." ; }"
77 77 p="${PWD/~(El)${HOME}/\~}"
78 78 (( ${#p} > 30 )) &&
79 79 print -r -n -- "${ellip}${p:${#p}-30:30}" ||
80 80 print -r -n -- "${p}"
81 81 [[ "${LOGNAME}" == "root" ]] && print -n "# " || print -n "\$ "
82 82 )'
83 83 fi
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX