Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

..using . operator

Status
Not open for further replies.

patnim17

Programmer
Jun 19, 2005
111
US
I have a script called jvmEnv.sh, which sets the environment variables. The problem is when I just execute it, the variables are not set..but when I execute it with a . (dot)
like this:

/home:>. jvmEnv.sh (as opposed to just jvmEnv.sh)

it works fine...so my question is what is "." doing here?

newbie..to unix
patnim17
 
The (dot) command reads and executes commands inside the current shell (instead of spawn a new instance of the shell)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi,

That is what is called 'to source a script' in some unix papers.

In linux there is a command called 'source' that acts exactly as '.' operator.

Ali
 


The dot operator or the "source" command executes the commands in the script as if you had entered them on your command line in your current window. That's one reason not to have the command "exit" in scripts that you intend to "source" unless you really want to exit your current window.

 
Bottom line: man yoursh

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV said:
Bottom line: man yoursh
Code:
$ man yoursh
No manual entry for yoursh.
[upsidedown]

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top