ENV-NOTE of
SAM Kernel and Application
Updated 2020-03-22

Copyright (C) 2011, 2018, 2020 Joseph Rosevear, San Diego CA, USA.



bprofile:

Normally $sam_root/bprofile is invoked by a b-file, such as
$sam_root/begin or $sam_root/breekit (not $sam_root/bree).  bprofile
then defines and exports sam_env.

The value normally given to sam_env by bprofile is $sam_root/sam_env.



bstart:

The b-file (not $sam_root/bree) also normally invokes bstart.  bstart
is special because it normally defines and exports key variables
referenced by a subsequent invocation of $sam_env (see below).  Here
are the normal exports:

   export env_user=$HOME
   export env_config=$HOME/config



$sam_env:

$sam_env is then sourced by $sam_distro/go/sam (also known as
$sam_go/sam and $sam_root/opt/SAM_modules/main/go/sam).

$sam_env is a place to define and export variables and functions and do
other start-up things.  Its use as a place to export variables is its
primary use.  You can change SAM's behavior and configuration easily
that way.  See notes in $sam_go/sam and see the documentation.  Also
see file $sam_env itself.

Please don't try to run SAM commands from $sam_env.  That's not the
purpose of this file.

Here is something you could put in $sam_env:

   #OK, this is a test
   export test=bingo
   spot=black

Use this if You need to debug:

   export sam_debug=on

$sam_env is not a good place to put alias defintions.  Please put them
in your .bashrc.



Note:

   Look at file $sam_env.  It will set some variables used by the SAM
   distribution.  You will need to fix the variable definitions--read
   the notes in the file.



Here's an example function definition that you could put in sam_env:

   frog() {

      echo ribit
      return
   }

   declare -fx frog



In summary,

1.  Use $sam_env to control variables that are otherwise controlled
through file $sam_go/sam.

2.  Use $sam_env as the starting point for your own file.

3.  Put into ~/.bashrc your aliases and shell functions that you use
when not in SAM.  They will be available at the SAM command prompt.

4.  Put in $sam_env variable definitions, and even shell functions that
you use in SAM, and use declare -fx as I've shown above.  These
functions will be available in SAM.



aaa:

Normally, at the end of $sam_env, $env_config/aaa is invoked.  This is
intended to be your chance to run a script to define and export your
own, private, variables.
