Advertisement

A Question about Linux Konsole (shell)

Started by October 12, 2003 04:32 PM
5 comments, last by pars 21 years, 3 months ago
I have installed exactly the same version of linux (Mandrake 9.1) that we use in college at home. When I want to execute a compiled C++ program at college I just type the name of the executable file (eg. Test ). But to run the same executable file at home, I have to include "./" infront of the filename (that is ./Test ). Can you tell me why I have to do this and how to correct it. Many Thanks
----Khalije Hamishegiye Faars!!!!
you need to include "." in your PATH
Advertisement
Unlike Windows, DOS, or OS/2, Unix does not implicitly include the current directory in the path. This is seen as a security issue, because, otherwise, a executable foo in the current directory would be run instead of one you expect to be run called foo that''s explicitly in the path. Therefore, you must specify either the full or relative path (which would be the ./ bit). If you really want to know how to do it, there are Unix FAQs out there that will tell you.
ever notice the everything unix forum?
quote:
Original post by C-Junkie
ever notice the everything unix forum?

Probably should be there, shouldn''t it? Makes more sense than it being in General Programming. Even though it''s already been answered, I''ll move it...
quote:
Original post by pars
Can you tell me why I have to do this and how to correct it.



This is standard behaviour - you would technically be breaking something that is already correct (in Unix terms).
My stuff.Shameless promotion: FreePop: The GPL god-sim.
Advertisement
Including it in the path is a very bad security practice, since people can put various executables, like "ls" in various directories, so if you type "ls" you will execute that program, instead of the real ls, which is somewhere in /usr/bin or wherever it is.
While this is fine if it is a single user machine, on a multi user machine, where you don''t trust the others, it is a very bad idea to do that.

Height Map Editor | Eternal Lands | Fast User Directory

This topic is closed to new replies.

Advertisement