PTC MKS Toolkit Knowledge Base

Section:IO
Product:MKS Toolkit (All)
Version:
OS:All
Keywords:variable, visible, dot, source
Category:Utilities/Knowledge Base


How can I make variables set in a script visible outside of that script?


The only way to do this is to run the script in the current environment. On UNIX this would be done for any script starting with a '.'. Historically, filenames could not start with a '.' on the PC.

KornShell:
In the KornShell there is a separate command . (dot) that will run a script in the current environment.

Example:

    . script.ksh

C Shell:
In the C Shell use the source command to run a script in the current environment.

Example:

    source script.csh

Bash:
In the MKS Bash shell, both . and source are supported as above.