Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-24-2006, 08:38 AM   #1
Registered: Jan 2005
Posts: 53

Rep: Reputation: 15
Running the executable in LINUX

Hi All,

Lets take there is a executable file called TestEXE

Is there any difference between the two following commands

. TestEXE



When exactly these two notations are useful ?

Thanks well in adavance.

Suresh bhat
Old 07-24-2006, 08:45 AM   #2
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430

Rep: Reputation: 39
Try this

echo env > newfile
chmod 755 newfile


. newfile

See the difference in environment variables.
You can notice that SHLVL value is diff in the two commands.

If ./newfile a new shell is spawned and the command executed in that shell.

In '. newfile' the command is executed in the same shell.
Old 07-24-2006, 08:50 AM   #3
Registered: Jan 2005
Posts: 53

Original Poster
Rep: Reputation: 15
Thanks a lot for the speedy reply.
Old 07-24-2006, 08:51 AM   #4
LQ Newbie
Registered: Jun 2006
Location: Pretoria
Distribution: Fedora Core 4
Posts: 5

Rep: Reputation: 0

As I have it:

This means the file is hidden in the current directory.
if you go : vi Test and then press TAB to auto complete you will get no response but
if you try: vi .Test and then press TAB to auto complete you will get a list of all the hidden file starting with 'Test' in current directoy

./ -> means current directory
Say you have a script in /usr/bin/ called 'TestEXE' and in your home directory a different script also called 'TestEXE', then by typing ./TestEXE in your home directory your specifying to use this script in your pwd.

Hope it helps.
Old 07-24-2006, 09:59 AM   #5
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
If the first character is a dot, this is a synonym for the source command. The source command runs the script in the same shell instead of the launching a subshell. This is done for configuration scripts like the scripts in /etc/sysconfig/ and for you shell start up scripts, because then you can set variables in you script.

It is normal not to have the current directory, "." in your PATH variable, so to launch a program in the current directory you can precede the command with "./". You could also launch a script in the current directory like this: sh scriptname, or by using the full pathname. /home/username/scriptname.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a Java executable class from another executable class LUB997 Programming 22 07-24-2005 04:57 AM
Running an executable. wesleyarchbell Linux - Software 4 05-03-2005 03:50 AM
running an executable wogga Linux - Software 8 06-12-2004 04:21 AM
running an executable aznamvet Linux - Software 5 06-10-2004 07:08 AM
running windows executable in linux anamika123 Linux - Software 8 06-05-2003 12:31 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration