[NBLUG/talk] fighting Ubuntu, and the "source" bash command

Lincoln Peters anfrind at gmail.com
Mon Jul 7 09:29:55 PDT 2008


On Mon, Jul 7, 2008 at 8:28 AM, Bob Blick <bobblick at ftml.net> wrote:
> That's funny because in the past if I had a script I wanted to execute
> I'd either make sure it had a shebang (#!/bin/bash) line in it or else
> just preface the script name with /bin/bash on the command line. That's
> just how I'd always done it. So does "source" do exactly the same thing,
> or is it the new improved way to do this?

The difference is that the "source" commands executes the script in
your current environment, whereas other methods of execution execute
the script in a COPY of your current environment.  That makes the
"source" command useful if, for example, you sometimes want to set a
bunch of environment variables with a single command but you don't
always want them set, or you have multiple configurations you want to
be able to choose from.


-- 
Lincoln Peters
<anfrind at gmail.com>



More information about the talk mailing list