source: postlfs/config/profile.xml@ 8558044

11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 8558044 was 8558044, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove spaces at the end of lines

I know it is somewhat useless, but I don't like them for
two reasons: first they cannot be seen, and I do not like things I
cannot see. Second, git highlights them, and this is disturbing...

  • Property mode set to 100644
File size: 23.1 KB
RevLine 
[f8d632a]1<?xml version="1.0" encoding="ISO-8859-1"?>
[6732c094]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[f8d632a]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
[78b3cd61]8<sect1 id="postlfs-config-profile" xreflabel="The Bash Shell Startup Files">
[2753b70b]9 <?dbhtml filename="profile.html"?>
10
11 <sect1info>
12 <date>$Date$</date>
13 </sect1info>
14
15 <title>The Bash Shell Startup Files</title>
16
[81a73ed8]17 <para>
18 The shell program <filename>/bin/bash</filename> (hereafter referred to
19 as just "the shell") uses a collection of startup files to help create
20 an environment. Each file has a specific use and may affect login and
21 interactive environments differently. The files in the <filename
22 class="directory">/etc</filename> directory generally provide global
23 settings. If an equivalent file exists in your home directory it may
24 override the global settings.
25 </para>
26
27 <para>
28 An interactive login shell is started after a successful login, using
29 <filename>/bin/login</filename>, by reading the
30 <filename>/etc/passwd</filename> file. This shell invocation normally reads
31 <filename>/etc/profile</filename> and its private equivalent
32 <filename>~/.bash_profile</filename> (or <filename>~/.profile</filename>
33 if called as <command>/bin/sh</command>) upon startup.
[8558044]34 </para>
[81a73ed8]35
36 <para>
37 An interactive non-login shell is normally started at the command-line
38 using a shell program (e.g.,
39 <prompt>[prompt]$</prompt><command>/bin/bash</command>) or by the
40 <command>/bin/su</command> command. An interactive non-login shell is also
41 started with a terminal program such as <command>xterm</command> or
42 <command>konsole</command> from within a graphical environment. This type
43 of shell invocation normally copies the parent environment and then reads
44 the user's <filename>~/.bashrc</filename> file for additional startup
45 configuration instructions.
46 </para>
47
48 <para>
49 A non-interactive shell is usually present when a shell script is
50 running. It is non-interactive because it is processing a script and not
51 waiting for user input between commands. For these shell invocations, only
52 the environment inherited from the parent shell is used.
53 </para>
54
55 <para>
56 The file <filename>~/.bash_logout</filename> is not used for an
57 invocation of the shell. It is read and executed when a user exits from an
58 interactive login shell.
59 </para>
60
61 <para>
62 Many distributions use <filename>/etc/bashrc</filename> for system wide
63 initialization of non-login shells. This file is usually called from the
64 user's <filename>~/.bashrc</filename> file and is not built directly into
65 <command>bash</command> itself. This convention is followed in this
66 section.
67 </para>
68
69 <para>
70 For more information see <command>info bash</command> --
71 <emphasis role="strong">Nodes: Bash Startup Files and Interactive
72 Shells</emphasis>.
73 </para>
[ba0deaad]74
75 <note>
[81a73ed8]76 <para>
77 Most of the instructions below are used to create files located in the
78 <filename class='directory'>/etc</filename> directory structure which
79 requires you to execute the commands as the <systemitem
80 class='username'>root</systemitem> user. If you elect to create the
81 files in user's home directories instead, you should run the commands
82 as an unprivileged user.
83 </para>
[ba0deaad]84 </note>
[2753b70b]85
[81a73ed8]86 <para condition="html" role="usernotes">User Notes:
87 <ulink url="&blfs-wiki;/bash-shell-startup-files"/></para>
[5c3f3856]88
[2753b70b]89 <sect2 id="etc-profile-profile">
90 <title>/etc/profile</title>
91
92 <indexterm zone="postlfs-config-profile etc-profile-profile">
93 <primary sortas="e-etc-profile">/etc/profile</primary>
94 </indexterm>
95
[81a73ed8]96 <para>
97 Here is a base <filename>/etc/profile</filename>. This file starts by
98 setting up some helper functions and some basic parameters. It specifies
99 some <command>bash</command> history parameters and, for security
100 purposes, disables keeping a permanent history file for the <systemitem
101 class="username">root</systemitem> user. It also sets a default user
102 prompt. It then calls small, single purpose scripts in the <filename
103 class='directory'>/etc/profile.d</filename> directory to provide most
104 of the initialization.
105 </para>
106
107 <para>
108 For more information on the escape sequences you can use for your prompt
109 (i.e., the <envar>PS1</envar> environment variable) see <command>info
110 bash</command> -- <emphasis role="strong">Node: Printing a
111 Prompt</emphasis>.
112 </para>
[2753b70b]113
[8e37798]114<screen role="root"><?dbfo keep-together="auto"?><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
[2753b70b]115<literal># Begin /etc/profile
[b554263]116# Written for Beyond Linux From Scratch
117# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[1a396398]118# modifications by Dagmar d'Surreal &lt;rivyqntzne@pbzpnfg.arg&gt;
[384039a]119
[b554263]120# System wide environment variables and startup programs.
[384039a]121
[b554263]122# System wide aliases and functions should go in /etc/bashrc. Personal
123# environment variables and startup programs should go into
124# ~/.bash_profile. Personal aliases and functions should go into
125# ~/.bashrc.
[384039a]126
[1a396398]127# Functions to help us manage paths. Second argument is the name of the
128# path variable to be modified (default: PATH)
129pathremove () {
130 local IFS=':'
131 local NEWPATH
132 local DIR
133 local PATHVARIABLE=${2:-PATH}
134 for DIR in ${!PATHVARIABLE} ; do
135 if [ "$DIR" != "$1" ] ; then
136 NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
137 fi
138 done
139 export $PATHVARIABLE="$NEWPATH"
[b554263]140}
[384039a]141
[1a396398]142pathprepend () {
143 pathremove $1 $2
144 local PATHVARIABLE=${2:-PATH}
145 export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
146}
[384039a]147
[1a396398]148pathappend () {
149 pathremove $1 $2
150 local PATHVARIABLE=${2:-PATH}
151 export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
152}
[384039a]153
[ec7940be]154export -f pathremove pathprepend pathappend
[e9ef7b5e]155
156# Set the initial path
[b149d10]157export PATH=/usr/bin
158
159# Attempt to provide backward compatibility with LFS earlier than 11
160if [ ! -L /bin ]; then
161 pathappend /bin
162fi
[e9ef7b5e]163
[1a396398]164if [ $EUID -eq 0 ] ; then
[b149d10]165 pathappend /usr/sbin
166 if [ ! -L /sbin ]; then
167 pathappend /sbin
168 fi
[1a396398]169 unset HISTFILE
[b554263]170fi
[384039a]171
[1a396398]172# Setup some environment variables.
173export HISTSIZE=1000
174export HISTIGNORE="&amp;:[bf]g:exit"
[0d7ec6f1]175
[97c713e]176# Set some defaults for graphical systems
[caee7667]177export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/share/}
178export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg/}
179export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp/xdg-$USER}
[97c713e]180
[410e228b]181# Setup a red prompt for root and a green one for users.
[0d7ec6f1]182NORMAL="\[\e[0m\]"
183RED="\[\e[1;31m\]"
184GREEN="\[\e[1;32m\]"
185if [[ $EUID == 0 ]] ; then
186 PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
187else
188 PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
189fi
[384039a]190
[1a396398]191for script in /etc/profile.d/*.sh ; do
[d3880c0]192 if [ -r $script ] ; then
[1a396398]193 . $script
194 fi
195done
[384039a]196
[f91e4b98]197unset script RED GREEN NORMAL
[dc53944]198
[2753b70b]199# End /etc/profile</literal>
200EOF</userinput></screen>
[1a396398]201
[2753b70b]202 <sect3 id="etc-profile.d">
203 <title>The /etc/profile.d Directory</title>
[99e8a229]204
[2753b70b]205 <indexterm zone="postlfs-config-profile etc-profile.d">
206 <primary sortas="e-etc-profile.d">/etc/profile.d</primary>
207 </indexterm>
[1a396398]208
[81a73ed8]209 <para>
210 Now create the <filename class='directory'>/etc/profile.d</filename>
211 directory, where the individual initialization scripts are placed:
212 </para>
[1a396398]213
[2753b70b]214<screen role="root"><userinput>install --directory --mode=0755 --owner=root --group=root /etc/profile.d</userinput></screen>
[1a396398]215
[2753b70b]216 </sect3>
[1a396398]217
[931a597]218 <sect3 id="etc-profile.d-bash-completion.sh">
219 <title>/etc/profile.d/bash_completion.sh</title>
220
221 <indexterm zone="postlfs-config-profile etc-profile.d-bash-completion.sh">
222 <primary sortas="e-etc-profile.d-bash-completion.sh">/etc/profile.d/bash_completion.sh</primary>
223 </indexterm>
224
[81a73ed8]225 <note>
226 <para>
227 Using the bash completion script below is controversial. Not all
228 users like it. It adds many (usually over 1000) lines to the bash
229 environment and makes it difficult to use the 'set' command to
230 examine simple environment variables. Omitting this script does
231 not interfere with the ability of bash to use the tab key for file
232 name completion.
233 </para>
234 </note>
235
236 <para>
237 This script imports bash completion scripts, installed by many
238 other BLFS packages, to allow TAB command line completion.
239 </para>
[931a597]240
241<screen role="root"><userinput>cat &gt; /etc/profile.d/bash_completion.sh &lt;&lt; "EOF"
242<literal># Begin /etc/profile.d/bash_completion.sh
243# Import bash completion scripts
244
[5c3f3856]245# If the bash-completion package is installed, use its configuration instead
246if [ -f /usr/share/bash-completion/bash_completion ]; then
247
248 # Check for interactive bash and that we haven't already been sourced.
249 if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then
250
251 # Check for recent enough version of bash.
252 if [ ${BASH_VERSINFO[0]} -gt 4 ] || \
253 [ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; then
254 [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] &amp;&amp; \
255 . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
256 if shopt -q progcomp &amp;&amp; [ -r /usr/share/bash-completion/bash_completion ]; then
257 # Source completion code.
258 . /usr/share/bash-completion/bash_completion
259 fi
260 fi
261 fi
262
263else
264
265 # bash-completions are not installed, use only bash completion directory
266 if shopt -q progcomp; then
267 for script in /etc/bash_completion.d/* ; do
268 if [ -r $script ] ; then
269 . $script
270 fi
271 done
272 fi
273fi
274
[931a597]275# End /etc/profile.d/bash_completion.sh</literal>
276EOF</userinput></screen>
[81a73ed8]277 <para>
278 Make sure that the directory exists:
279 </para>
[931a597]280
281<screen role="root"><userinput>install --directory --mode=0755 --owner=root --group=root /etc/bash_completion.d</userinput></screen>
282
[81a73ed8]283 <para>
284 For a more complete installation, see
285 <ulink url="&blfs-wiki;/bash-shell-startup-files#bash-completions"/>.
286 </para>
[931a597]287
[5c3f3856]288 </sect3>
[931a597]289
[2753b70b]290 <sect3 id="etc-profile.d-dircolors.sh">
291 <title>/etc/profile.d/dircolors.sh</title>
292
293 <indexterm zone="postlfs-config-profile etc-profile.d-dircolors.sh">
294 <primary sortas="e-etc-profile.d-dircolors.sh">/etc/profile.d/dircolors.sh</primary>
295 </indexterm>
296
[81a73ed8]297 <para>
298 This script uses the <filename>~/.dircolors</filename> and
299 <filename>/etc/dircolors</filename> files to control the colors of
300 file names in a directory listing. They control colorized output of
301 things like <command>ls --color</command>. The explanation of how to
302 initialize these files is at the end of this section.
303 </para>
[2753b70b]304
305<screen role="root"><userinput>cat &gt; /etc/profile.d/dircolors.sh &lt;&lt; "EOF"
[b5905ae]306<literal># Setup for /bin/ls and /bin/grep to support color, the alias is in /etc/bashrc.
[1a396398]307if [ -f "/etc/dircolors" ] ; then
308 eval $(dircolors -b /etc/dircolors)
[89ef45fc]309fi
[384039a]310
[89ef45fc]311if [ -f "$HOME/.dircolors" ] ; then
312 eval $(dircolors -b $HOME/.dircolors)
[b554263]313fi
[89ef45fc]314
[b5905ae]315alias ls='ls --color=auto'
316alias grep='grep --color=auto'</literal>
[2753b70b]317EOF</userinput></screen>
318
319 </sect3>
320
321 <sect3 id="extrapaths.sh">
322 <title>/etc/profile.d/extrapaths.sh</title>
323
324 <indexterm zone="postlfs-config-profile extrapaths.sh">
325 <primary sortas="e-etc-profile.d-extrapaths.sh">/etc/profile.d/extrapaths.sh</primary>
326 </indexterm>
327
[81a73ed8]328 <para>
329 This script adds some useful paths to the <envar>PATH</envar> and
330 can be used to customize other PATH related environment variables
331 (e.g. LD_LIBRARY_PATH, etc) that may be needed for all users.
332 </para>
[384039a]333
[2753b70b]334<screen role="root"><userinput>cat &gt; /etc/profile.d/extrapaths.sh &lt;&lt; "EOF"
335<literal>if [ -d /usr/local/lib/pkgconfig ] ; then
[1a396398]336 pathappend /usr/local/lib/pkgconfig PKG_CONFIG_PATH
337fi
338if [ -d /usr/local/bin ]; then
339 pathprepend /usr/local/bin
[b554263]340fi
[1a396398]341if [ -d /usr/local/sbin -a $EUID -eq 0 ]; then
342 pathprepend /usr/local/sbin
[a4f641b]343fi
[bfa21f3]344
345# Set some defaults before other applications add to these paths.
346pathappend /usr/share/man MANPATH
[a4f641b]347pathappend /usr/share/info INFOPATH</literal>
[2753b70b]348EOF</userinput></screen>
349
350 </sect3>
351
352 <sect3 id="readline.sh">
353 <title>/etc/profile.d/readline.sh</title>
354
355 <indexterm zone="postlfs-config-profile readline.sh">
356 <primary sortas="e-etc-profile.d-readline.sh">/etc/profile.d/readline.sh</primary>
357 </indexterm>
358
[81a73ed8]359 <para>
360 This script sets up the default <filename>inputrc</filename>
361 configuration file. If the user does not have individual settings, it
362 uses the global file.
363 </para>
[2753b70b]364
365<screen role="root"><userinput>cat &gt; /etc/profile.d/readline.sh &lt;&lt; "EOF"
366<literal># Setup the INPUTRC environment variable.
[b554263]367if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then
[1a396398]368 INPUTRC=/etc/inputrc
[b554263]369fi
[2753b70b]370export INPUTRC</literal>
371EOF</userinput></screen>
372
373 </sect3>
374
375 <sect3 id="umask.sh">
376 <title>/etc/profile.d/umask.sh</title>
377
378 <indexterm zone="postlfs-config-profile umask.sh">
379 <primary sortas="e-etc-profile.d-umask.sh">/etc/profile.d/umask.sh</primary>
380 </indexterm>
[384039a]381
[81a73ed8]382 <para>
383 Setting the <command>umask</command> value is important for security.
384 Here the default group write permissions are turned off for system
385 users and when the user name and group name are not the same.
386 </para>
[b554263]387
[2753b70b]388<screen role="root"><userinput>cat &gt; /etc/profile.d/umask.sh &lt;&lt; "EOF"
[ec64d28]389<literal># By default, the umask should be set.
[1a396398]390if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then
391 umask 002
392else
393 umask 022
[2753b70b]394fi</literal>
395EOF</userinput></screen>
396
397 </sect3>
398
[be409f9a]399<!-- This is handled in the Xorg section of the book
[2753b70b]400 <sect3 id="X.sh">
401 <title>/etc/profile.d/X.sh</title>
[1a396398]402
[2753b70b]403 <indexterm zone="postlfs-config-profile X.sh">
404 <primary sortas="e-etc-profile.d-X.sh">/etc/profile.d/X.sh</primary>
405 </indexterm>
[1a396398]406
[81a73ed8]407 <para>
408 If <application>X</application> is installed, the <envar>PATH</envar>
409 and <envar>PKG_CONFIG_PATH</envar> variables are also updated.
410 </para>
[1a396398]411
[2753b70b]412<screen role="root"><userinput>cat &gt; /etc/profile.d/X.sh &lt;&lt; "EOF"
413<literal>if [ -x /usr/X11R6/bin/X ]; then
[1a396398]414 pathappend /usr/X11R6/bin
415fi
416if [ -d /usr/X11R6/lib/pkgconfig ] ; then
417 pathappend /usr/X11R6/lib/pkgconfig PKG_CONFIG_PATH
[2753b70b]418fi</literal>
419EOF</userinput></screen>
420
421 </sect3>
[be409f9a]422-->
[d202a49f]423 <sect3 id="i18n.sh">
424 <!-- This is handled system wide on systemd but LANG is not exported to
425 the environment, hence it's return...need to add additional text for
426 systemd only -->
[0d7ec6f1]427 <title>/etc/profile.d/i18n.sh</title>
[2753b70b]428
429 <indexterm zone="postlfs-config-profile i18n.sh">
430 <primary sortas="e-etc-profile.d-i18n.sh">/etc/profile.d/i18n.sh</primary>
431 </indexterm>
432
[81a73ed8]433 <para>
434 This script sets an environment variable necessary for
435 native language support. A full discussion on determining this
436 variable can be found on the <ulink
[f0dc9578]437 url="&lfs-root;/chapter09/profile.html">LFS Bash Shell
[81a73ed8]438 Startup Files</ulink> page.
439 </para>
[2753b70b]440
[1794983d]441<screen role="root" revision="sysv"><userinput>cat &gt; /etc/profile.d/i18n.sh &lt;&lt; "EOF"
[2753b70b]442<literal># Set up i18n variables
[0f442884]443export LANG=<replaceable>&lt;ll&gt;</replaceable>_<replaceable>&lt;CC&gt;</replaceable>.<replaceable>&lt;charmap&gt;</replaceable><replaceable>&lt;@modifiers&gt;</replaceable></literal>
[1794983d]444EOF</userinput></screen>
445
446<screen role="root" revision="systemd"><userinput>cat &gt; /etc/profile.d/i18n.sh &lt;&lt; "EOF"
447<literal># Set up i18n variables
448. /etc/locale.conf
449export LANG</literal>
[2753b70b]450EOF</userinput></screen>
451
452 </sect3>
453
454 <sect3>
455 <title>Other Initialization Values</title>
456
[81a73ed8]457 <para>
458 Other initialization can easily be added to the
459 <filename>profile</filename> by adding additional scripts to the
460 <filename class='directory'>/etc/profile.d</filename> directory.
461 </para>
[2753b70b]462
463 </sect3>
464
465 </sect2>
466
467 <sect2 id="etc-bashrc-profile">
468 <title>/etc/bashrc</title>
469
470 <indexterm zone="postlfs-config-profile etc-bashrc-profile">
471 <primary sortas="e-etc-bashrc">/etc/bashrc</primary>
472 </indexterm>
473
[81a73ed8]474 <para>
475 Here is a base <filename>/etc/bashrc</filename>. Comments in the
476 file should explain everything you need.
477 </para>
[2753b70b]478
479<screen role="root"><userinput>cat &gt; /etc/bashrc &lt;&lt; "EOF"
[384039a]480<literal># Begin /etc/bashrc
481# Written for Beyond Linux From Scratch
[b554263]482# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[4e88613]483# updated by Bruce Dubbs &lt;bdubbs@&lfs-domainname;&gt;
[ad33bab6]484
[b554263]485# System wide aliases and functions.
486
487# System wide environment variables and startup programs should go into
488# /etc/profile. Personal environment variables and startup programs
489# should go into ~/.bash_profile. Personal aliases and functions should
490# go into ~/.bashrc
491
[b5905ae]492# Provides colored /bin/ls and /bin/grep commands. Used in conjunction
493# with code in /etc/profile.
[1a396398]494
[b554263]495alias ls='ls --color=auto'
[b5905ae]496alias grep='grep --color=auto'
[b554263]497
[1a396398]498# Provides prompt for non-login shells, specifically shells started
[2753b70b]499# in the X environment. [Review the LFS archive thread titled
[384039a]500# PS1 Environment Variable for a great case study behind this script
[dd362e5]501# addendum.]
[1a396398]502
[0d7ec6f1]503NORMAL="\[\e[0m\]"
504RED="\[\e[1;31m\]"
505GREEN="\[\e[1;32m\]"
506if [[ $EUID == 0 ]] ; then
507 PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
508else
509 PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
510fi
[28a9992]511
[dc53944]512unset RED GREEN NORMAL
513
[2753b70b]514# End /etc/bashrc</literal>
515EOF</userinput></screen>
516
517 </sect2>
518
519 <sect2 id="bash_profile-profile">
520 <title>~/.bash_profile</title>
521
522 <indexterm zone="postlfs-config-profile bash_profile-profile">
523 <primary sortas="e-AA.bash_profile">~/.bash_profile</primary>
524 </indexterm>
525
[81a73ed8]526 <para>
527 Here is a base <filename>~/.bash_profile</filename>. If you want each
528 new user to have this file automatically, just change the output of
529 the command to <filename>/etc/skel/.bash_profile</filename> and check the
530 permissions after the command is run. You can then copy <filename>
531 /etc/skel/.bash_profile</filename> to the home directories of already
532 existing users, including <systemitem class="username">root</systemitem>,
533 and set the owner and group appropriately.
534 </para>
[2753b70b]535
536<screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"
537<literal># Begin ~/.bash_profile
[b554263]538# Written for Beyond Linux From Scratch
539# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[4e88613]540# updated by Bruce Dubbs &lt;bdubbs@&lfs-domainname;&gt;
[b554263]541
[64d97b7c]542# Personal environment variables and startup programs.
[b554263]543
544# Personal aliases and functions should go in ~/.bashrc. System wide
545# environment variables and startup programs are in /etc/profile.
546# System wide aliases and functions are in /etc/bashrc.
547
548if [ -f "$HOME/.bashrc" ] ; then
[76d61ba]549 source $HOME/.bashrc
[b554263]550fi
551
552if [ -d "$HOME/bin" ] ; then
[dc53944]553 pathprepend $HOME/bin
[b554263]554fi
555
[dc53944]556# Having . in the PATH is dangerous
557#if [ $EUID -gt 99 ]; then
558# pathappend .
559#fi
[b554263]560
[2753b70b]561# End ~/.bash_profile</literal>
562EOF</userinput></screen>
563
564 </sect2>
[384039a]565
[6f36554]566 <sect2 id="dot_profile-profile">
567 <title>~/.profile</title>
568
569 <indexterm zone="postlfs-config-profile dot_profile-profile">
570 <primary sortas="e-AA.dot_profile">~/.profile</primary>
571 </indexterm>
572
[81a73ed8]573 <para>
574 Here is a base <filename>~/.profile</filename>. The comments and
575 instructions for using <filename class="directory">/etc/skel</filename>
576 for <filename>.bash_profile</filename> above also apply here. Only the
577 target file names are different.
578 </para>
[6f36554]579
580<screen><userinput>cat &gt; ~/.profile &lt;&lt; "EOF"
581<literal># Begin ~/.profile
582# Personal environment variables and startup programs.
583
584if [ -d "$HOME/bin" ] ; then
585 pathprepend $HOME/bin
586fi
587
[d202a49f]588# Set up user specific i18n variables
589#export LANG=<replaceable>&lt;ll&gt;</replaceable>_<replaceable>&lt;CC&gt;</replaceable>.<replaceable>&lt;charmap&gt;</replaceable><replaceable>&lt;@modifiers&gt;</replaceable>
590
[6f36554]591# End ~/.profile</literal>
592EOF</userinput></screen>
593
594 </sect2>
595
[2753b70b]596 <sect2 id="bashrc-profile">
597 <title>~/.bashrc</title>
598
599 <indexterm zone="postlfs-config-profile bashrc-profile">
600 <primary sortas="e-AA.bashrc">~/.bashrc</primary>
601 </indexterm>
602
[81a73ed8]603 <para>
604 Here is a base <filename>~/.bashrc</filename>.
605 </para>
[2753b70b]606
607<screen><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
608<literal># Begin ~/.bashrc
[b554263]609# Written for Beyond Linux From Scratch
610# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
611
612# Personal aliases and functions.
613
614# Personal environment variables and startup programs should go in
[64d97b7c]615# ~/.bash_profile. System wide environment variables and startup
[b554263]616# programs are in /etc/profile. System wide aliases and functions are
[384039a]617# in /etc/bashrc.
[b554263]618
619if [ -f "/etc/bashrc" ] ; then
[76d61ba]620 source /etc/bashrc
[b554263]621fi
622
[d202a49f]623# Set up user specific i18n variables
624#export LANG=<replaceable>&lt;ll&gt;</replaceable>_<replaceable>&lt;CC&gt;</replaceable>.<replaceable>&lt;charmap&gt;</replaceable><replaceable>&lt;@modifiers&gt;</replaceable>
625
[2753b70b]626# End ~/.bashrc</literal>
627EOF</userinput></screen>
628
629 </sect2>
[384039a]630
631
[2753b70b]632 <sect2 id="bash_logout-profile">
633 <title>~/.bash_logout</title>
634
635 <indexterm zone="postlfs-config-profile bash_logout-profile">
636 <primary sortas="e-AA.bash_logout">~/.bash_logout</primary>
637 </indexterm>
638
[81a73ed8]639 <para>
640 This is an empty <filename>~/.bash_logout</filename> that can be used as
641 a template. You will notice that the base <filename>~/.bash_logout
642 </filename> does not include a <userinput>clear</userinput> command.
643 This is because the clear is handled in the
644 <filename>/etc/issue</filename> file.
645 </para>
[2753b70b]646
647<screen><userinput>cat &gt; ~/.bash_logout &lt;&lt; "EOF"
648<literal># Begin ~/.bash_logout
[b554263]649# Written for Beyond Linux From Scratch
650# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
651
652# Personal items to perform on logout.
653
[2753b70b]654# End ~/.bash_logout</literal>
655EOF</userinput></screen>
656
657 </sect2>
[384039a]658
659
[2753b70b]660 <sect2 id="etc-dircolors-profile">
661 <title>/etc/dircolors</title>
662
663 <indexterm zone="postlfs-config-profile etc-dircolors-profile">
664 <primary sortas="e-etc-dircolors">/etc/dircolors</primary>
665 </indexterm>
666
667 <indexterm zone="postlfs-config-profile etc-dircolors-profile">
668 <primary sortas="e-AA.dircolors">~/.dircolors</primary>
669 </indexterm>
670
[81a73ed8]671 <para>
672 If you want to use the <filename>dircolors</filename> capability, then
673 run the following command. The <filename class="directory">/etc/skel
674 </filename> setup steps shown above also can be used here to provide
675 a <filename>~/.dircolors</filename> file when a new user is set up.
676 As before, just change the output file name on the following command
677 and assure the permissions, owner, and group are correct on the files
678 created and/or copied.
679 </para>
[2753b70b]680
681<screen role="root"><userinput>dircolors -p > /etc/dircolors</userinput></screen>
682
[81a73ed8]683 <para>
684 If you wish to customize the colors used for different file types, you
685 can edit the <filename>/etc/dircolors</filename> file. The instructions
686 for setting the colors are embedded in the file.
687 </para>
[2753b70b]688
689
[81a73ed8]690 <para>
691 Finally, Ian Macdonald has written an excellent collection of tips and
692 tricks to enhance your shell environment. You can read it online at
693 <ulink url="http://www.caliban.org/bash/index.shtml"/>.
694 </para>
[2753b70b]695
696 </sect2>
697
[b554263]698</sect1>
Note: See TracBrowser for help on using the repository browser.