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!

What's the difference between source and "."?

Status
Not open for further replies.

goldenradium2001

Technical User
Mar 22, 2002
91
US
I tried to source a file in the C shell but could only use the keyword "source". Why am I not able to source a file using the dot "."?

 
Goldenradium:

The "." operator is bourne/korn/bash specific syntax - not csh. I'm not an expert on the "C" shell, but this issue was covered in this thread:

thread822-255445

Regards,

Ed
 
The differnce is only the SHELL.

source file -- csh
. file -- sh, ksh, bash

they do exactly the same thing. read the file in an apply it to the current shell.

----
 
The dot(.) command is a built-in Korn and Bourne shell command.
It takes a script name as an argument. The script will be executed
in the environment of the current shell. A child process will not be
started. The dot command is normally used to reexecute the .profile file
or the ENV file, if either of those files has been modified. For example,
if one of the settings in either file has been changed after you have logged on,
you can use the dot command to reexecute the initialization files without
logging out and then logging back.

The source command is a built-in C shell command.
It causes the program to be executed in the current shell, so that any
variables set within the file will become part of the environment of the
current shell. The source command is normally used to reexecute the .cshrc or .login
if either has been modified.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top