80 lines
4.5 KiB
HTML
80 lines
4.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE>3.13.3 Shell initialization scripts</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value="3.13.3 Shell initialization scripts">
|
|
<meta name="keywords" value="gs">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3686 HREF="node154.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3684 HREF="node149.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3680 HREF="node152.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3688 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3689 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3687 HREF="node154.html">3.14 So You Want </A>
|
|
<B>Up:</B> <A NAME=tex2html3685 HREF="node149.html">3.13 Customizing your Environment</A>
|
|
<B> Previous:</B> <A NAME=tex2html3681 HREF="node152.html">3.13.2.1 The PATH environment </A>
|
|
<BR> <HR> <P>
|
|
<H2><A NAME=SECTION005133000000000000000>3.13.3 Shell initialization scripts</A></H2>
|
|
<A NAME=secinitscripts> </A>
|
|
<A NAME=4116> </A>
|
|
<A NAME=4117> </A>
|
|
In addition to shell scripts that you create, there are a number
|
|
of scripts that the shell itself uses for certain purposes. The
|
|
most important of these are your <b>initialization scripts</b>, scripts
|
|
automatically executed by the shell when you login.
|
|
<P>
|
|
The initialization scripts themselves are simply shell scripts, as
|
|
described above. However, they are very useful in setting up your
|
|
environment by executing commands automatically when you
|
|
login. For example, if you always use the <tt>mail</tt> command to check your
|
|
mail when you login, you place the command in your
|
|
initialization script so it will be executed automatically.
|
|
<P>
|
|
<A NAME=4120> </A>
|
|
Both Bash and Tcsh distinguish between a <b>login shell</b> and other
|
|
invocations of the shell. A login shell is a shell invoked at login time;
|
|
usually, it's the only shell which you'll use. However, if you ``shell out''
|
|
of another program, such as <tt>vi</tt>, you start another instance of
|
|
the shell, which isn't your login shell. In addition, whenever you run
|
|
a shell script, you automatically start another instance of the shell to
|
|
execute the script.
|
|
<P>
|
|
<A NAME=4123> </A>
|
|
<A NAME=4124> </A>
|
|
<A NAME=4150> </A>
|
|
<A NAME=4151> </A>
|
|
<A NAME=4152> </A>
|
|
<A NAME=4153> </A>
|
|
The initialization files used by Bash are: <tt>/etc/profile</tt> (set up
|
|
by the system administrator, executed by all Bash users at login time),
|
|
<tt>$HOME/.bash_profile</tt> (executed by a login Bash session), and
|
|
<tt>$HOME/.bashrc</tt> (executed by all non-login instances of Bash).
|
|
If <tt>.bash_profile</tt> is not present, <tt>.profile</tt> is used instead.
|
|
<P>
|
|
<A NAME=4154> </A>
|
|
<A NAME=4155> </A>
|
|
Tcsh uses the following initialization scripts: <tt>/etc/csh.login</tt>
|
|
(executed by all Tcsh users at login time), <tt>$HOME/.tcshrc</tt>
|
|
(executed a login time and by all new instances of Tcsh), and
|
|
<tt>$HOME/.login</tt> (executed at login time, following <tt>.tcshrc</tt>).
|
|
If <tt>.tcshrc</tt> is not present, <tt>.cshrc</tt> is used instead.
|
|
<P>
|
|
To fully understand the function of these files, you'll need to learn
|
|
more about the shell itself. Shell programming is a complicated subject,
|
|
far beyond the scope of this book. See the man pages for <tt>bash</tt> and/or
|
|
<tt>tcsh</tt> to learn more about customizing your shell environment.
|
|
<P>
|
|
<A NAME=4144> </A>
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3686 HREF="node154.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3684 HREF="node149.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3680 HREF="node152.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3688 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3689 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3687 HREF="node154.html">3.14 So You Want </A>
|
|
<B>Up:</B> <A NAME=tex2html3685 HREF="node149.html">3.13 Customizing your Environment</A>
|
|
<B> Previous:</B> <A NAME=tex2html3681 HREF="node152.html">3.13.2.1 The PATH environment </A>
|
|
<BR> <HR> <P>
|
|
<BR> <HR>
|
|
<P><ADDRESS>
|
|
<I>Matt Welsh <BR>
|
|
mdw@sunsite.unc.edu</I>
|
|
</ADDRESS>
|
|
</BODY>
|