Blame Artworks/Documentation/Docbook/Tcar-ug/Scripts/Bash/environment.docbook

Alain Reguera Delgado 46de3c
<sect1 id="scripts-bash-environment">
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <title>The Execution Environment</title>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The execution environment of <command>centos-art.sh</command>
Alain Reguera Delgado 46de3c
        script is organized in four levels.  The first level is the
Alain Reguera Delgado 46de3c
        <quote>shell environment</quote>, the second level is the
Alain Reguera Delgado 46de3c
        <quote>command environment</quote>, the third level is the
Alain Reguera Delgado 46de3c
        <quote>common functions environment</quote> and, finally, the
Alain Reguera Delgado 46de3c
        fourth level which contains the <quote>specific function
Alain Reguera Delgado 46de3c
        environment</quote>, as described in 
Alain Reguera Delgado 46de3c
        linkend="scripts-bash-environment-example1" />.  In this
Alain Reguera Delgado 46de3c
        context, child environments inherit definitions (e.g.,
Alain Reguera Delgado 46de3c
        variables and functions) from their parent environments making
Alain Reguera Delgado 46de3c
        possible to logically organize the script in a way that needs
Alain Reguera Delgado 46de3c
        can be isolated one another to follow the paradigm proposed by
Alain Reguera Delgado 46de3c
        Unix developers at Bell Labs when felt that programs
Alain Reguera Delgado 46de3c
        <quote>should do one thing well.</quote>
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <example id="scripts-bash-environment-example1">
Alain Reguera Delgado 46de3c
    <title>The execution environment</title>
Alain Reguera Delgado 46de3c
    <screenshot>
Alain Reguera Delgado 46de3c
    <screeninfo>The execution environment</screeninfo>
Alain Reguera Delgado 46de3c
    <mediaobject>
Alain Reguera Delgado 46de3c
    <textobject>
Alain Reguera Delgado 46de3c
<programlisting>
Alain Reguera Delgado 46de3c
+-----------------------------------------------------+
Alain Reguera Delgado 46de3c
| Shell environment                                   |
Alain Reguera Delgado 46de3c
+---|-------------------|-----------------|-----------+
Alain Reguera Delgado 46de3c
.   |-- TCAR_WORKDIR    |-- TCAR_BRAND    |-- EDITOR  .
Alain Reguera Delgado 46de3c
.   |-- LANG            |-- HOME          |-- PATH    .
Alain Reguera Delgado 46de3c
.   `-- centos-art.sh   `-- TMPDIR        `-- ...     .
Alain Reguera Delgado 46de3c
.   +---|-----------------------------------------+   .
Alain Reguera Delgado 46de3c
.   | Command environment                         |   .
Alain Reguera Delgado 46de3c
.   +---|---------------|----------------|--------+   .
Alain Reguera Delgado 46de3c
.   .   |-- CLI_NAME    |-- CLI_VERSION  `-- ...  .   .
Alain Reguera Delgado 46de3c
.   .   |-- CLI_FUNCDIR `-- CLI_BASEDIR           .   .
Alain Reguera Delgado 46de3c
.   .   `-- cli()                                 .   .
Alain Reguera Delgado 46de3c
.   .   +---|-----------------------------------+ .   .
Alain Reguera Delgado 46de3c
.   .   | Common functions environment          | .   .
Alain Reguera Delgado 46de3c
.   .   +---|------------------------|----------+ .   .
Alain Reguera Delgado 46de3c
.   .   .   |-- cli_printMessage()   |-- ...    . .   .
Alain Reguera Delgado 46de3c
.   .   .   |-- cli_getFilesList()   |-- ...    . .   .
Alain Reguera Delgado 46de3c
.   .   .   `-- render()             `-- ...    . .   .
Alain Reguera Delgado 46de3c
.   .   .   +---|---------------------------+   . .   .
Alain Reguera Delgado 46de3c
.   .   .   | Specific function environment |   . .   .
Alain Reguera Delgado 46de3c
.   .   .   +-------------------------------+   . .   .
Alain Reguera Delgado 46de3c
.   .   ......................................... .   .
Alain Reguera Delgado 46de3c
.   ...............................................   .
Alain Reguera Delgado 46de3c
.......................................................
Alain Reguera Delgado 46de3c
</programlisting>
Alain Reguera Delgado 46de3c
    </textobject>
Alain Reguera Delgado 46de3c
    </mediaobject>
Alain Reguera Delgado 46de3c
    </screenshot>
Alain Reguera Delgado 46de3c
    </example>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <sect2>
Alain Reguera Delgado 46de3c
    <title>The Shell Environment</title>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <command>centos-art.sh</command> script uses the following
Alain Reguera Delgado 46de3c
        shell environment variables:
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <variablelist>
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><envar>PATH</envar></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <envar>PATH</envar> environment variable is specific to
Alain Reguera Delgado 46de3c
        the operating system and provides search paths for command
Alain Reguera Delgado 46de3c
        execution.  By default, the <command>centos-art.sh</command>
Alain Reguera Delgado 46de3c
        script links executable scripts from the 
Alain Reguera Delgado 46de3c
        class="directory">~/bin</filename> directory which is one of
Alain Reguera Delgado 46de3c
        the locations used as search path in this variable. This is
Alain Reguera Delgado 46de3c
        how we create the <command>centos-art</command> command from
Alain Reguera Delgado 46de3c
        the <command>centos-art.sh</command> script inside your
Alain Reguera Delgado 46de3c
        working copy.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        This variable is not initialized inside the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script. Instead, the value
Alain Reguera Delgado 46de3c
        set in <filename>~/.bash_profile</filename> file is used. 
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><envar>EDITOR</envar></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <envar>EDITOR</envar> environment variable is specific to
Alain Reguera Delgado 46de3c
        the operating system and provides the path to your default
Alain Reguera Delgado 46de3c
        text editor. The <command>centos-art.sh</command> script uses
Alain Reguera Delgado 46de3c
        the default text editor to edit subversion pre-commit
Alain Reguera Delgado 46de3c
        messages, translation files, documentation files, script
Alain Reguera Delgado 46de3c
        files, and similar text-based files.  
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Possible values for this variable are:
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <itemizedlist>
Alain Reguera Delgado 46de3c
        <listitem>
Alain Reguera Delgado 46de3c
        <para>
Alain Reguera Delgado 46de3c
            <filename class="directory">/usr/bin/vim</filename>
Alain Reguera Delgado 46de3c
        </para>
Alain Reguera Delgado 46de3c
        </listitem>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
        <listitem>
Alain Reguera Delgado 46de3c
        <para>
Alain Reguera Delgado 46de3c
        <filename class="directory">/usr/bin/emacs</filename>
Alain Reguera Delgado 46de3c
        </para>
Alain Reguera Delgado 46de3c
        </listitem>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
        <listitem>
Alain Reguera Delgado 46de3c
        <para>
Alain Reguera Delgado 46de3c
            <filename class="directory">/usr/bin/nano</filename>
Alain Reguera Delgado 46de3c
        </para>
Alain Reguera Delgado 46de3c
        </listitem>
Alain Reguera Delgado 46de3c
    </itemizedlist>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        In case none of these values is set for the
Alain Reguera Delgado 46de3c
        <envar>EDITOR</envar> environment variable inside
Alain Reguera Delgado 46de3c
        <filename>~/.bash_profile</filename>, the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script uses 
Alain Reguera Delgado 46de3c
        class="directory">/usr/bin/vim</filename> as default text
Alain Reguera Delgado 46de3c
        editor. This is the text editor installed by default in &TC;;. 
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><varname>TEXTDOMAIN</varname></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <envar>TEXTDOMAIN</envar> environment variable is specific
Alain Reguera Delgado 46de3c
        to the operating system and provides the domain name of that
Alain Reguera Delgado 46de3c
        application we are producing translation messages for. This
Alain Reguera Delgado 46de3c
        variable, in combination with <envar>TEXTDOMAINDIR</envar>, is
Alain Reguera Delgado 46de3c
        used by <application>gettext</application> to find out the
Alain Reguera Delgado 46de3c
        location of translation messages.  In the very specific case
Alain Reguera Delgado 46de3c
        of <command>centos-art.sh</command> script we use the
Alain Reguera Delgado 46de3c
        <literal>centos-art.sh</literal> name as domain name.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        This variable is initialized inside the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script, so if you set it
Alain Reguera Delgado 46de3c
        outside it (e.g., in <filename>~/.bash_profile</filename>) the
Alain Reguera Delgado 46de3c
        value you set there will be overwritten by that one set inside
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script, once it is executed.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><varname>TEXTDOMAINDIR</varname></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <envar>TEXTDOMAINDIR</envar> environment variable is
Alain Reguera Delgado 46de3c
        specific to the operating system and provides the absolute
Alain Reguera Delgado 46de3c
        path to the directory containing the translation messages
Alain Reguera Delgado 46de3c
        related to that application specified by
Alain Reguera Delgado 46de3c
        <envar>TEXTDOMAIN</envar> environment variable.  In the very
Alain Reguera Delgado 46de3c
        specific case of <command>centos-art.sh</command> script we
Alain Reguera Delgado 46de3c
        use the 
Alain Reguera Delgado 46de3c
        class="directory">Locales/Scripts/Bash</filename>
Alain Reguera Delgado 46de3c
        path as default value.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        This variable is initialized inside the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script, so if you set it
Alain Reguera Delgado 46de3c
        outside it (e.g., in <filename>~/.bash_profile</filename>) the
Alain Reguera Delgado 46de3c
        value you set there will be overwritten by that one set inside
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script, once it is executed.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><envar>TMPDIR</envar></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <envar>TMPDIR</envar> environment variable is specific to
Alain Reguera Delgado 46de3c
        the operating system and provides the absolute path to the
Alain Reguera Delgado 46de3c
        temporal directory the centos-art.sh script will use along its
Alain Reguera Delgado 46de3c
        execution. This variable is defined inside the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script itself using the
Alain Reguera Delgado 46de3c
        <command>mktemp</command> command and will be unique on each
Alain Reguera Delgado 46de3c
        script execution. Thus, you should be able to run several
Alain Reguera Delgado 46de3c
        instances of <command>centos-art.sh</command> script
Alain Reguera Delgado 46de3c
        simultaneously without any problem. 
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        When you contribute code to <command>centos-art.sh</command>
Alain Reguera Delgado 46de3c
        script and need to create temporal files, do it inside the
Alain Reguera Delgado 46de3c
        absolute path specified by this variable.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        This variable is redefined inside the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script, so if you set it
Alain Reguera Delgado 46de3c
        outside it (e.g., in <filename>~/.bash_profile</filename>) the
Alain Reguera Delgado 46de3c
        value you set there will be overwritten by that one set inside
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script, once it is executed.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><envar>LANG</envar></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <envar>LANG</envar> environment variable is specific to
Alain Reguera Delgado 46de3c
        the operating system and controls the default locale
Alain Reguera Delgado 46de3c
        information of it.  The <command>centos-art.sh</command>
Alain Reguera Delgado 46de3c
        script use the <envar>LANG</envar> environment variable to
Alain Reguera Delgado 46de3c
        determine what language to use for printing output messages
Alain Reguera Delgado 46de3c
        from the script itself, as well as the portable objects
Alain Reguera Delgado 46de3c
        locations that need to be updated or edited when you localize
Alain Reguera Delgado 46de3c
        directory structures inside the working copy of &TCAR;.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
        
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <envar>LANG</envar> environment variable is initially set
Alain Reguera Delgado 46de3c
        in the installation process of &TC;;, specifically in the
Alain Reguera Delgado 46de3c
        <emphasis>Language</emphasis> step.  Generally, there is no
Alain Reguera Delgado 46de3c
        need to customize this variable in your personal profile. If
Alain Reguera Delgado 46de3c
        you need to change the value of this environment variable do
Alain Reguera Delgado 46de3c
        it through the login screen of GNOME Desktop Environment or
Alain Reguera Delgado 46de3c
        the <command>system-config-language</command> command, or even
Alain Reguera Delgado 46de3c
        resetting the variable before executing the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    </variablelist>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        In addition to shell environment variables described above,
Alain Reguera Delgado 46de3c
        the <command>centos-art.sh</command> script adds the following
Alain Reguera Delgado 46de3c
        variables inside the <filename>~/.bash_profile</filename> file
Alain Reguera Delgado 46de3c
        to control the script behaviour in a per-user level:
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <variablelist>
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><varname>TCAR_WORKDIR</varname></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <envar>TCAR_WORKDIR</envar> environment variable is
Alain Reguera Delgado 46de3c
        specific to <command>centos-art.sh</command> script and
Alain Reguera Delgado 46de3c
        controls the working copy default location of &TCAR;.  This is
Alain Reguera Delgado 46de3c
        the place in your workstation where &TCAR; file system is
Alain Reguera Delgado 46de3c
        stored for you to work with it.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        By default, just after installing your workstation, this
Alain Reguera Delgado 46de3c
        variable will not be found in it and the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script will finish its
Alain Reguera Delgado 46de3c
        execution with an error message if you try to execute it
Alain Reguera Delgado 46de3c
        without any argument. This behaviour is OK because the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script doesn't know where you
Alain Reguera Delgado 46de3c
        stored the working copy of &TCAR; in your workstation. In
Alain Reguera Delgado 46de3c
        order for this variable to exist in your workstation you need
Alain Reguera Delgado 46de3c
        to configure your workstation first, as described in 
Alain Reguera Delgado 46de3c
        linkend="repo-ws-config" />.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><varname>TCAR_BRAND</varname></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <envar>TCAR_BRAND</envar> environment variable is specific
Alain Reguera Delgado 46de3c
        to <command>centos-art.sh</command> script and controls the
Alain Reguera Delgado 46de3c
        brand information that identifies the content produced inside
Alain Reguera Delgado 46de3c
        &TCAR;. The brand information is used to give name to some
Alain Reguera Delgado 46de3c
        files inside the repository (e.g., see files under 
Alain Reguera Delgado 46de3c
        class="directory">Identity/Models/Brands</filename>
Alain Reguera Delgado 46de3c
        directory).
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        By default, this variable takes <quote>centos</quote> as
Alain Reguera Delgado 46de3c
        value. In case you want to change it to something else, you
Alain Reguera Delgado 46de3c
        should consider the following implications:
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    <itemizedlist>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <command>centos-art.sh</command> script will no longer be
Alain Reguera Delgado 46de3c
        referred as such. Instead, the
Alain Reguera Delgado 46de3c
        <filename>${TCAR_BRAND}-art.sh</filename> name will be used.
Alain Reguera Delgado 46de3c
        This implies that you no longer are using the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> file we provide as part of
Alain Reguera Delgado 46de3c
        &TCAR; and won't be able to commit changes to it. However, if
Alain Reguera Delgado 46de3c
        you retain the same logic from
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script in
Alain Reguera Delgado 46de3c
        <filename>${TCAR_WORKDIR}-art.sh</filename>, you can use
Alain Reguera Delgado 46de3c
        common and specific functionalities provided by
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script and commit changes to
Alain Reguera Delgado 46de3c
        them.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The files stored under 
Alain Reguera Delgado 46de3c
        class="directory">Identity/Models/Brands</filename>
Alain Reguera Delgado 46de3c
        should be named using the value of
Alain Reguera Delgado 46de3c
        <literal>${TCAR_BRAND}</literal> as section. If you change
Alain Reguera Delgado 46de3c
        the value of this variable, you need to be sure the new value
Alain Reguera Delgado 46de3c
        set does coincide with the file names you use to store brand
Alain Reguera Delgado 46de3c
        information.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </itemizedlist>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
    </variablelist>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    </sect2>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <sect2>
Alain Reguera Delgado 46de3c
    <title>The Command Environment</title>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The first file the <command>centos-art.sh</command> script
Alain Reguera Delgado 46de3c
        calls is the
Alain Reguera Delgado 46de3c
        <filename>Scripts/Bash/Functions/Commons/cli.sh</filename>
Alain Reguera Delgado 46de3c
        file. This file initializes all variables and functions you
Alain Reguera Delgado 46de3c
        will be able to use along the script execution environment
Alain Reguera Delgado 46de3c
        lifetime.  Such environment variables are for internal use
Alain Reguera Delgado 46de3c
        inside the <command>centos-art.sh</command> script only and
Alain Reguera Delgado 46de3c
        users shouldn't modify them to customize the script in a
Alain Reguera Delgado 46de3c
        per-user level.  Instead, to customize the script behaviour in
Alain Reguera Delgado 46de3c
        a per-user level, you need to make use of your personal
Alain Reguera Delgado 46de3c
        environment variables set in the
Alain Reguera Delgado 46de3c
        <filename>~/.bash_profile</filename> file.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Once environment variables are initialized, the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script initializes common and
Alain Reguera Delgado 46de3c
        specific environment functions, in that order.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <sect3>
Alain Reguera Delgado 46de3c
    <title>Common Function Environment</title>
Alain Reguera Delgado 46de3c
    
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Common function environments are stored under 
Alain Reguera Delgado 46de3c
        class="directory">Scripts/Bash/Functions/Commons</filename>
Alain Reguera Delgado 46de3c
        directory and will be available always, both for common
Alain Reguera Delgado 46de3c
        environment functions themselves and specific environment
Alain Reguera Delgado 46de3c
        functions.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    </sect3>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <sect3>
Alain Reguera Delgado 46de3c
    <title>Specific Function Environments</title>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Specific function environments, on the other hand, are stored
Alain Reguera Delgado 46de3c
        in the 
Alain Reguera Delgado 46de3c
        class="directory">Scripts/Bash/Functions/${CLI_FUNCDIRNAM}/${CLI_FUNCNAME}.sh</filename>
Alain Reguera Delgado 46de3c
        file, where:
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <variablelist>
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><varname>CLI_FUNCDIRNAME</varname></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Is the first argument passed to
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script with the first letter
Alain Reguera Delgado 46de3c
        in uppercase but the rest in lowercase. For example,
Alain Reguera Delgado 46de3c
        <literal>Render</literal>, <literal>Locale</literal> and
Alain Reguera Delgado 46de3c
        <literal>Help</literal> are all possible values to this
Alain Reguera Delgado 46de3c
        variable.
Alain Reguera Delgado 46de3c
     </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><varname>CLI_FUNCNAME</varname></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Is the first argument passed to
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script with all letters in
Alain Reguera Delgado 46de3c
        lowercase. For example, <literal>render</literal>,
Alain Reguera Delgado 46de3c
        <literal>locale</literal> and <literal>help</literal> are all
Alain Reguera Delgado 46de3c
        possible values to this variable. 
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
    </variablelist>
Alain Reguera Delgado 46de3c
    
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Specific functions environment can be written in just one file
Alain Reguera Delgado 46de3c
        or in several files inside the same directory. Using one file
Alain Reguera Delgado 46de3c
        to write specific functions environment is rarely seen inside
Alain Reguera Delgado 46de3c
        the <command>centos-art.sh</command> script but it could
Alain Reguera Delgado 46de3c
        happen in situations where the need you want to solve can be
Alain Reguera Delgado 46de3c
        written in a few lines inside just one file. On the other
Alain Reguera Delgado 46de3c
        hand, if you find yourself writing a too long file, it is
Alain Reguera Delgado 46de3c
        convenient to logically divide it into several files. This
Alain Reguera Delgado 46de3c
        logical division takes place using functions, which indeed
Alain Reguera Delgado 46de3c
        create other environments where you can create and express
Alain Reguera Delgado 46de3c
        your solutions.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The order in which individual files are exported and executed
Alain Reguera Delgado 46de3c
        inside the specific functions environments depends in the way
Alain Reguera Delgado 46de3c
        each developer write the 
Alain Reguera Delgado 46de3c
        class="directory">Scripts/Bash/Functions/${CLI_FUNCDIRNAM}/${CLI_FUNCNAME}.sh</filename>
Alain Reguera Delgado 46de3c
        file. This is the main file inside the specific function
Alain Reguera Delgado 46de3c
        environment and controls the kind of logical division you
Alain Reguera Delgado 46de3c
        implement to organize the solution you need. As file name
Alain Reguera Delgado 46de3c
        convention, the following structure for new specific functions
Alain Reguera Delgado 46de3c
        environment is proposed:
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
<programlisting>
Alain Reguera Delgado 46de3c
Scripts/Bash/Functions/${CLI_FUNCDIRNAM}/
Alain Reguera Delgado 46de3c
|-- ${CLI_FUNCNAME}.sh
Alain Reguera Delgado 46de3c
`-- ${CLI_FUNCNAME}_verbSubject.sh
Alain Reguera Delgado 46de3c
</programlisting>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Specific functions environment is exported after common
Alain Reguera Delgado 46de3c
        functions environment does, so it is not possible for specific
Alain Reguera Delgado 46de3c
        functions environment to be available inside the common
Alain Reguera Delgado 46de3c
        functions environment, nor inside other specific functions
Alain Reguera Delgado 46de3c
        environment, different to the one been passed as first
Alain Reguera Delgado 46de3c
        argument to the <command>centos-art.sh</command> script
Alain Reguera Delgado 46de3c
        command-line.<footnote>
Alain Reguera Delgado 46de3c
            <para>
Alain Reguera Delgado 46de3c
                Although, it is possible for you to call the
Alain Reguera Delgado 46de3c
                <command>centos-art.sh</command> script to itself
Alain Reguera Delgado 46de3c
                through the <function>cli_runFnEnvironment</function>
Alain Reguera Delgado 46de3c
                common function environment.
Alain Reguera Delgado 46de3c
            </para>
Alain Reguera Delgado 46de3c
        </footnote> In 
Alain Reguera Delgado 46de3c
        linkend="scripts-bash-environment-example1" />,
Alain Reguera Delgado 46de3c
        <function>render</function> is a specific function environment
Alain Reguera Delgado 46de3c
        while <function>cli_printMessage</function> and
Alain Reguera Delgado 46de3c
        <function>cli_getFilesList</function> are common function
Alain Reguera Delgado 46de3c
        environments.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Both specific and common function environments exist to
Alain Reguera Delgado 46de3c
        standardize frequent tasks inside &TCAR;. The following
Alain Reguera Delgado 46de3c
        sections will describe which these frequent tasks are and the
Alain Reguera Delgado 46de3c
        way they are standardized using specific and common function
Alain Reguera Delgado 46de3c
        environments.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </sect3>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    </sect2>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
</sect1>