[ -f ] tests if a file exists.
~ is shell shorthand for your home/user directory. Files personal to you are stored there.
~/.bashrc, if it exists, is another
bash startup file, in your home directory, that usually gets run when you start
bash interactively (that is, when you're not just calling
bash to execute a pre-existing
bash script file). The example file you're looking at is probably meant to be a
.profile, which is another shell startup script that typically only gets run when you're first logging into the system. If you have commands you only want run when you log in, you put them in
~/.profile. If you have commands that set up your interactive shell environment (like aliases that make commands easier to invoke), then you put them in your
.bashrc. Since login shells are also interactive shells, you usually want your
.profile to also load ("source") your
When your shell looks for commands to run, it consults the environment variable
PATH. This line exports it so that other commands you invoke from the shell know where to find other commands. It also adds the directory
/usr/local/bin to the
PATH so that the shell and programs it runs also looks for commands there.
BASH_ENV defines what startup script
bash should run if it's being invoked in a non-login, non-interactive situation. I guess it's being exported so that if you invoke a non-interactive
bash instance (like to execute a pre-existing script file), it will still run your
.bashrc. I don't usually want non-interactive shells running my
.bashrc, so I would never define
BASH_ENV the way it is defined in this example file you found.
GNUTERM is defined as being the string
aqua. It's being defined and exported at the same time. Since you're on a Mac, which might not have XWindows (X11) installed, this is telling your GNUTerm/GNUPlot/GNUOctave environment what tool to run to draw your plots to the screen. Probably aquaterm, which you might want to make sure you've installed if you haven't already. I don't know about the whole Mac variants of the GNUOctave/GNUPlot/GNUterm/aquaterm ecosystem, so I can't advise you on the nitty-gritty details.