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! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-24-2006, 08:38 AM
|
#1
|
Member
Registered: Jan 2005
Posts: 53
Rep:
|
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
AND
./TestEXE
When exactly these two notations are useful ?
Thanks well in adavance.
Thanks,
Suresh bhat
|
|
|
07-24-2006, 08:45 AM
|
#2
|
Member
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430
Rep:
|
Try this
echo env > newfile
chmod 755 newfile
./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.
|
|
|
07-24-2006, 08:50 AM
|
#3
|
Member
Registered: Jan 2005
Posts: 53
Original Poster
Rep:
|
Thanks a lot for the speedy reply.
|
|
|
07-24-2006, 08:51 AM
|
#4
|
LQ Newbie
Registered: Jun 2006
Location: Pretoria
Distribution: Fedora Core 4
Posts: 5
Rep:
|
Hi,
As I have it:
.TestEXE
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
./TestEXE
./ -> 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.
|
|
|
07-24-2006, 09:59 AM
|
#5
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
All times are GMT -5. The time now is 12:46 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|