- Timestamp:
- 12/11/2002 10:50:10 PM (22 years ago)
- Branches:
- 10.0, 10.1, 11.0, 11.1, 11.2, 11.3, 12.0, 12.1, 6.0, 6.1, 6.2, 6.2.0, 6.2.0-rc1, 6.2.0-rc2, 6.3, 6.3-rc1, 6.3-rc2, 6.3-rc3, 7.10, 7.4, 7.5, 7.6, 7.6-blfs, 7.6-systemd, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, basic, bdubbs/svn, elogind, gnome, kde5-13430, kde5-14269, kde5-14686, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, krejzi/svn, lazarus, lxqt, nosym, perl-modules, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, systemd-11177, systemd-13485, trunk, upgradedb, v1_0, v5_0, v5_0-pre1, v5_1, v5_1-pre1, xry111/intltool, xry111/llvm18, xry111/soup3, xry111/test-20220226, xry111/xf86-video-removal
- Children:
- 2cda8d5
- Parents:
- e421318
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
postlfs/config/profile.xml
re421318 rb554263 1 1 <sect1 id="postlfs-config-profile"> 2 2 <?dbhtml filename="profile.html" dir="postlfs"?> 3 <title> /etc/profile and ~/.bash_*</title>3 <title>The Bash Shell Startup Files</title> 4 4 5 <para>NEW PAGE TO BE WRITTEN</para> 5 <para>The shell program <filename>/bin/bash</filename> (hereafter 6 refered to as just "the shell") uses a collection of startup files to 7 help create an environment to run in. Each file has a specific use and 8 may affect login and interactive environments differently.</para> 9 10 <para>An interactive login shell is started after a successful login by 11 <filename>/bin/login</filename> by reading the /etc/passwd file. An 12 interactive non-login shell is started at the command line (e.g. 13 [prompt]$<userinput>/bin/bash</userinput>). A non-interactive shell is 14 usually present when a shell script is running. It is non-interactive 15 because it is processing a script and not waiting for user input between 16 commands.</para> 17 18 <para>For more information see <filename>info bash</filename> -- Nodes: 19 Bash Startup Files and Interactive Shells</para> 20 21 <para>The following files are needed to make sure that the correct 22 environment is read for each of the ways the shell can be invoked: 23 <filename>/etc/profile</filename>, <filename>/etc/bashrc</filename>, 24 <filename>~/.bash_profile</filename>, and 25 <filename>~/.bashrc</filename>. The file 26 <filename>~/.bash_logout</filename> is not used for an invokation of the 27 shell. It is read by the shell when a user logouts of the system. The 28 files <filename>/etc/profile</filename> and 29 <filename>~/.bash_profile</filename> are read when the shell is invoked 30 as a interactive login shell. The file <filename>~/.bashrc</filename> 31 is read when the shell is invoked as an interactive non-login 32 shell.</para> 33 34 <para>Here is a base <filename>/etc/profile</filename>.</para> 35 36 <para><screen># Begin /etc/profile 37 # Written for Beyond Linux From Scratch 38 # by James Robertson <jameswrobertson@earthlink.net> 39 40 # System wide environment variables and startup programs. 41 42 # System wide aliases and functions should go in /etc/bashrc. Personal 43 # environment variables and startup programs should go into 44 # ~/.bash_profile. Personal aliases and functions should go into 45 # ~/.bashrc. 46 47 # Function to help us manage paths 48 pathman () { 49 if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then 50 if [ "$2" = "last" ] ; then 51 PATH=$PATH:$1 52 else 53 PATH=$1:$PATH 54 fi 55 fi 56 } 57 58 # Add to the standard path. 59 if [ $(id -u) = 0 ] ; then 60 if [ -d "/usr/local/sbin" ] ; then 61 pathman /usr/local/sbin last 62 fi 63 fi 64 65 if [ $(id -u) != 0 ] ; then 66 if [ -d "/usr/local/bin" ] ; then 67 pathman /usr/local/bin last 68 fi 69 fi 70 71 if [ -d "/usr/X11R6/bin" ] ; then 72 pathman /usr/X11R6/bin last 73 fi 74 75 # Setup some environment variables. 76 HISTSIZE=1000 77 PS1="[\u@\h \w]\\$ " 78 79 # Setup the INPUTRC environment variable. 80 if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then 81 INPUTRC=/etc/inputrc 82 fi 83 84 # Setup for /bin/ls to support color, the alias is in /etc/bashrc. 85 if [ -f "/etc/dircolors" ] ; then 86 eval $(dircolors -b /etc/dircolors) 87 88 if [ -f "$HOME/.dircolors" ] ; then 89 eval $(dircolors -b $HOME/.dircolors) 90 fi 91 fi 92 93 export PATH HISTSIZE PS1 LS_COLORS INPUTRC 94 95 # End /etc/profile</screen></para> 96 97 98 <para>Here is a base <filename>/etc/bashrc</filename>. Comments in the 99 file should explain everything you need.</para> 100 101 <para><screen># Begin /etc/bashrc 102 # Written for Beyond Linux From Scratch 103 # by James Robertson <jameswrobertson@earthlink.net> 104 105 # System wide aliases and functions. 106 107 # System wide environment variables and startup programs should go into 108 # /etc/profile. Personal environment variables and startup programs 109 # should go into ~/.bash_profile. Personal aliases and functions should 110 # go into ~/.bashrc 111 112 # By default we want the umask to get set. 113 # Even for non-interactive and non-login shells. 114 if [ "$(id -gn)" = "$(id -un)" -a $(id -u) -gt 99 ] ; then 115 umask 002 116 else 117 umask 022 118 fi 119 120 # Provides a colored /bin/ls command. Used in conjunction with code in 121 # /etc/profile. 122 alias ls='ls --color=auto' 123 124 # End /etc/bashrc</screen></para> 125 126 <para>Here is a base <filename>~/.bash_profile</filename>. Comments in 127 the file should explain everything you need.</para> 128 129 <para><screen># Begin ~/.bash_profile 130 # Written for Beyond Linux From Scratch 131 # by James Robertson <jameswrobertson@earthlink.net> 132 133 # Personal envrionment variables and startup programs. 134 135 # Personal aliases and functions should go in ~/.bashrc. System wide 136 # environment variables and startup programs are in /etc/profile. 137 # System wide aliases and functions are in /etc/bashrc. 138 139 if [ -f "$HOME/.bashrc" ] ; then 140 . $HOME/.bashrc 141 fi 142 143 if [ -d "$HOME/bin" ] ; then 144 pathman $HOME/bin last 145 fi 146 147 export PATH 148 149 # End ~/.bash_profile</screen></para> 150 151 <para>Here is a base <filename>~/.bashrc</filename>. Comments in the 152 file should explain everything you need.</para> 153 154 <para><screen># Begin ~/.bashrc 155 # Written for Beyond Linux From Scratch 156 # by James Robertson <jameswrobertson@earthlink.net> 157 158 # Personal aliases and functions. 159 160 # Personal environment variables and startup programs should go in 161 # ~/.bash_profile. System wide environment variables and starup 162 # programs are in /etc/profile. System wide aliases and functions are 163 # in /etc/bashrc. 164 165 if [ -f "/etc/bashrc" ] ; then 166 . /etc/bashrc 167 fi 168 169 # End ~/.bashrc</screen></para> 170 171 <para>Here is a base <filename>~/.bash_logout</filename>. Comments in 172 the file should explain everything you need.</para> 173 174 <para><screen># Begin ~/.bash_logout 175 # Written for Beyond Linux From Scratch 176 # by James Robertson <jameswrobertson@earthlink.net> 177 178 # Personal items to perform on logout. 179 180 # End ~/.bash_logout</screen></para> 181 182 <para>If you want to use the <filename>/etc/dircolors</filename> or 183 <filename>~/.dircolors</filename> files called from 184 <filename>/etc/profile</filename>, then run the following: 185 <userinput>/bin/dircolors -p > /etc/dircolors</userinput> or 186 <userinput>/bin/dircolors -p > ~/.dircolors</userinput> respectively. 187 The file in the <filename>/etc</filename> directory should be used for 188 global settings and if one exists in your home directory then it will 189 overwrite the global settings. It might be a good idea to create a base 190 <filename>.dircolors</filename> file and place it in the 191 <filename>/etc/skel</filename> directory for new users.</para> 6 192 7 193 </sect1> 8
Note:
See TracChangeset
for help on using the changeset viewer.