[SATLUG] small script, baffled problem.

Robert Pearson e2eiod at gmail.com
Fri Aug 13 20:39:42 CDT 2010


On Fri, Aug 13, 2010 at 7:16 AM, Richard Suberg <rsuberg at satx.rr.com> wrote:

> I can see the use of variables, file status indicator isn't a bad idea,
> because this task either exits quick( failed mount), does some work (they
> updated stuff), or does a whole LOT of work (recovering from bad files)...
> But what is the difference between set $var and export $var? I haven't seen
> a lot about that, but have seen both used in various places.
>
>
"set $var" is for local environment variables. Local to the current in-line
or in-stream script only.
"export $var" makes that local environmental variable a
global environmental variable as well, so it is available to any spawned or
"child" scripts of the current local in-line or in-stream script.

IMHO, as a general rule, scripts running unattended and remotely need to be
as simple as possible with regard to global environmental variables. Try not
to have any. Add them if you find you need them. Login variables can be
different from machine to machine and versions of programs like shell script
interpreters can vary.

Play around with your script. Have fun with it, if you have the time. I
would set up simulated environments for development and testing. I worked in
a very secure IT environment and rarely ever got to log in on the
destination or source machines. Some scripts I wrote were so popular they
went all over the world and were installed in environments I never dreamed
of. I felt good about that.


More information about the SATLUG mailing list