source: postlfs/config/profile.xml@ b554263

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
Last change on this file since b554263 was b554263, checked in by Mark Hymers <markh@…>, 21 years ago

add James Robertsons bash profile page

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@448 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 6.1 KB
Line 
1<sect1 id="postlfs-config-profile">
2<?dbhtml filename="profile.html" dir="postlfs"?>
3<title>The Bash Shell Startup Files</title>
4
5<para>The shell program <filename>/bin/bash</filename> (hereafter
6refered to as just "the shell") uses a collection of startup files to
7help create an environment to run in. Each file has a specific use and
8may 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
12interactive non-login shell is started at the command line (e.g.
13[prompt]$<userinput>/bin/bash</userinput>). A non-interactive shell is
14usually present when a shell script is running. It is non-interactive
15because it is processing a script and not waiting for user input between
16commands.</para>
17
18<para>For more information see <filename>info bash</filename> -- Nodes:
19Bash Startup Files and Interactive Shells</para>
20
21<para>The following files are needed to make sure that the correct
22environment 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
27shell. It is read by the shell when a user logouts of the system. The
28files <filename>/etc/profile</filename> and
29<filename>~/.bash_profile</filename> are read when the shell is invoked
30as a interactive login shell. The file <filename>~/.bashrc</filename>
31is read when the shell is invoked as an interactive non-login
32shell.</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 &lt;jameswrobertson@earthlink.net&gt;
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
48pathman () {
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.
59if [ $(id -u) = 0 ] ; then
60 if [ -d "/usr/local/sbin" ] ; then
61 pathman /usr/local/sbin last
62 fi
63fi
64
65if [ $(id -u) != 0 ] ; then
66 if [ -d "/usr/local/bin" ] ; then
67 pathman /usr/local/bin last
68 fi
69fi
70
71if [ -d "/usr/X11R6/bin" ] ; then
72 pathman /usr/X11R6/bin last
73fi
74
75# Setup some environment variables.
76HISTSIZE=1000
77PS1="[\u@\h \w]\\$ "
78
79# Setup the INPUTRC environment variable.
80if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then
81 INPUTRC=/etc/inputrc
82fi
83
84# Setup for /bin/ls to support color, the alias is in /etc/bashrc.
85if [ -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
91fi
92
93export 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
99file should explain everything you need.</para>
100
101<para><screen># Begin /etc/bashrc
102# Written for Beyond Linux From Scratch
103# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
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.
114if [ "$(id -gn)" = "$(id -un)" -a $(id -u) -gt 99 ] ; then
115 umask 002
116else
117 umask 022
118fi
119
120# Provides a colored /bin/ls command. Used in conjunction with code in
121# /etc/profile.
122alias ls='ls --color=auto'
123
124# End /etc/bashrc</screen></para>
125
126<para>Here is a base <filename>~/.bash_profile</filename>. Comments in
127the 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 &lt;jameswrobertson@earthlink.net&gt;
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
139if [ -f "$HOME/.bashrc" ] ; then
140 . $HOME/.bashrc
141fi
142
143if [ -d "$HOME/bin" ] ; then
144 pathman $HOME/bin last
145fi
146
147export PATH
148
149# End ~/.bash_profile</screen></para>
150
151<para>Here is a base <filename>~/.bashrc</filename>. Comments in the
152file should explain everything you need.</para>
153
154<para><screen># Begin ~/.bashrc
155# Written for Beyond Linux From Scratch
156# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
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
165if [ -f "/etc/bashrc" ] ; then
166 . /etc/bashrc
167fi
168
169# End ~/.bashrc</screen></para>
170
171<para>Here is a base <filename>~/.bash_logout</filename>. Comments in
172the 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 &lt;jameswrobertson@earthlink.net&gt;
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.
187The file in the <filename>/etc</filename> directory should be used for
188global settings and if one exists in your home directory then it will
189overwrite 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>
192
193</sect1>
Note: See TracBrowser for help on using the repository browser.