Explanation of mk_fol_names Package

The Section Folder Name Variables gives an overview of this package. There are two scripts (mk_fol_names and mk_fol_names.install) and one data file (folder_table). You'll also be adding a line to your shell's setup file (like .login or .profile).

mk_fol_names

Here is the mk_fol_names script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.

mk_fol_names is a script with many links (names). The mk_fol_names.install script creates all of these links for you after you've set up the folder_table. We'll see how to do that later.

Here's what mk_fol_names does. When you run the script, it checks its name (from the $0 parameter) to decide which command to run and which folder name abbreviation to expand.

folder_table

The folder_table file has TAB-separated fields with a folder abbreviation followed by the folder(s) it stands for. Comment lines start with a hash mark (#).

You can store this file anywhere; its pathname is held by the table shell variable in the mk_fol_names and mk_fol_names.install scripts.

mk_fol_names.install

The mk_fol_names.install script must be run each time you add folder names to the folder_table file. This script reads the table and makes the links (like amj and fmj) that do the work. It also makes the links csh_folders and sh_folders to set the shell variable abbreviations.

If you customize mk_fol_names to understand commands with names that start in something other than a or f, you'll need to do the same to this script.

Your Shell's Setup File

To store shell variables, run csh_folders for csh and tcsh. Use sh_folders for sh, bash and ksh. (If you need some other syntax -- say, environment variables -- just modify the script and add a link to it.)

Run the command from your shell's startup file -- typically .cshrc for the C shell, .profile for the Bourne shell, and so on. For example, in the C shell:

    # Set shell variables with MH folder abbreviations:
    eval `csh_folders`
    
The backquotes (`) run csh_folders and leave its output (the commands to set the shell variables) as parameters for the eval command. The shell eval command re-scans and executes its parameters -- so, it sets the shell variables output by csh_folders.