Re: executing scripts



gpayne_onetel@xxxxxxxxxxx wrote:
HI,

Whats the difference in a scripts execution is I run it . ./scriptname
as opposed to ./scriptname.

What does the '.' do.

It 'sources' the script, so that all the commands are run in the current shell, as if you typed them.

I notice if I set variables and export them, there are only available
to use after script has executed with . ./script.

Why is this?

If you run without the dot, you are executing the script.
Another shell is run to execute the script. The variables are defined in the shell executing the command, and so you cant see them.

Regards
JohnT
.



Relevant Pages