Re: [newbie] Command execution
On Sat, 3 Jun 2000, Adrian Skywalker wrote: >If you must put . into your path, put it _after_ the other entries in your >path, not before, so that the existing command is called before the one in >the current directory. > >Just a thought, from an admitted newbie. > >Greetings, >Adrian But a VERY GOOD thought!! Paul -- The ultimate proof of love is trust )0([[EMAIL PROTECTED]])0( http://nlpagan.net - ICQ 147208 Registered Linux User 174403
Re: [newbie] Command execution
--- [EMAIL PROTECTED] wrote: > Perhaps the confusion here is that Windows looks in the logged > directory > FIRST and executes "namedcommand" if found. If the "namedcommand" is not > found it then searches the path, in order, and executes the first match it > > finds. I found this handy and will alter my bash preferences to search > the > local directory first, as suggested by Jim and others. Thanks, didn't > know > this behavior was that easy to alter. > -Gary- > If I could make a suggestion: Make sure you don't do this with root, because if you do, the potential exists to cause damage to your system. Say someone uploads a command "ls" into the FTP directory. You go to the FTP directory and type "ls," and the new "ls" command is executed instead of the Linux standard one. Now, let's say that the new "ls" is a shell script that does "rm -rf /*" ... If you must put . into your path, put it _after_ the other entries in your path, not before, so that the existing command is called before the one in the current directory. Just a thought, from an admitted newbie. Greetings, Adrian = ___ "But how am I to know the good side from the bad?" "You will _know._ When you are calm. At peace. Passive." -Luke and Yoda __ Do You Yahoo!? Yahoo! Photos -- now, 100 FREE prints! http://photos.yahoo.com
Re: [newbie] Command execution
I'm not sure if this has been answered yet, so here goes: the '.' before the slash (./) is sort of a 'wildcard'. It means just look in the directory that I'm in right now. I'm sure that you're aware that just a plain slash would mean that you want to look in the root directory for said file. Hope that makes sense ~Mike > > Can someone please explain the concept behind ./ in executing a command. > > > > If I am in the directory where the programme resides and type the > programme > > name, I get a: > > "bash: programme name: command not found" message > > > > If, from the same directory I type ./programme name everything works as > > advertised. > > > > Thanks > > > > Barry
Re: [newbie] Command execution
Perhaps the confusion here is that Windows looks in the logged directory FIRST and executes "namedcommand" if found. If the "namedcommand" is not found it then searches the path, in order, and executes the first match it finds. I found this handy and will alter my bash preferences to search the local directory first, as suggested by Jim and others. Thanks, didn't know this behavior was that easy to alter. -Gary- In a message dated 6/2/2000 3:27:59 AM Eastern Daylight Time, [EMAIL PROTECTED] writes: << > Can someone please explain the concept behind ./ in executing a command. > The . tells the system to look in the current directory, it is needed when you are trying to execute a program or shell script and your working directory is NOT in you path. The PATH environment variable tells the system where to look for programs and files on your system. Joseph H. Perry Oracle DBA Columbus State University 4225 University Ave Columbus, GA 31907-5645 (706) 568-2063 [EMAIL PROTECTED] >>
Re: [newbie] Command Execution
On Thu, 01 Jun 2000, you wrote: > Can someone please explain the concept behind ./ in executing a command. > > If I am in the directory where the programme resides and type the programme > name, I get a: > "bash: programme name: command not found" message > > If, from the same directory I type ./programme name everything works as > advertised. > > Thanks > > Barry Wherever you are, when you type a command name, the command interpreter (say bash) looks for this command in a certain set of directories : the list of the names of such directories is associated to the (environment) variable PATH. If none of these direcories contains the wanted command, the anwer of bash is "command not found". On the other side, when you type ./programme, you tell explicitly bash not to look for programme in the PATH listed directories, but in the present working directroy. The environment variable PATH recieves its value through a certain number of initialising files : /etc/profile ; ~/.profile ; ~/bash_profile ; etc. On the other side, in the bash/sh/csh/etc. world, the character "." indicates the directory in which you are, i.e. the present work directory. Piero. -- Dr Piero Caracciolo Ecole Normale Superieure ...humani nihil a me alienum puto.
Re: [newbie] Command execution
In a message dated 6/1/00 6:19:36 AM Mountain Daylight Time, [EMAIL PROTECTED] writes: > Can someone please explain the concept behind ./ in executing a command. > > If I am in the directory where the programme resides and type the programme > name, I get a: > "bash: programme name: command not found" message > > If, from the same directory I type ./programme name everything works as > advertised. > > Thanks > > Barry > The ./ means to look in the current directory rather than searching the "path" for the program. Jerry
RE: [newbie] Command execution
Hiyas, Being a newbie, I may have this totally wrong (please let me know if I do!). However, I believe it is due to some shells not considering the working directory part of the path. bash and tcsh do not consider the working directory (where you are currently entering commands) as a part of the execution path, so when you type in the name of a program in the local directory, it hunts through the path (/usr/bin, /sbin, etc.) and does not find the application. Problem: I don't know what shells don't do this. I suspect you could add ./ to the path list in .bashrc (or .tcshrc, etc.) for your shell, but I have never tried (and therefore don't know how). Half your answer! Maybe... :) Chris. > -Original Message- > From: Barry Winch [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, May 31, 2000 6:31 PM > To: [EMAIL PROTECTED] > Subject: [newbie] Command execution > > > Can someone please explain the concept behind ./ in executing > a command. > > If I am in the directory where the programme resides and type > the programme > name, I get a: > "bash: programme name: command not found" message > > If, from the same directory I type ./programme name > everything works as > advertised. > > Thanks > > Barry > >
Re: [[newbie] Command execution]
For you to use the "configure" command the PATH (not sure yet how to set the PATH) to THAT dir has to be listed. If you use the "./configure" command it means to run configure IN the dir your in. HTH Jaguar "Barry Winch" <[EMAIL PROTECTED]> wrote: > Can someone please explain the concept behind ./ in executing a command. > > If I am in the directory where the programme resides and type the programme > name, I get a: > "bash: programme name: command not found" message > > If, from the same directory I type ./programme name everything works as > advertised. > > Thanks > > Barry > The Dogma chased the Stigma, and was hit by the Karma. Get your own FREE, personal Netscape WebMail account today at http://webmail.netscape.com.
Re: [newbie] Command execution
On Wed, 31 May 2000, Barry Winch wrote: >Can someone please explain the concept behind ./ in executing a command. > >If I am in the directory where the programme resides and type the programme >name, I get a: >"bash: programme name: command not found" message > >If, from the same directory I type ./programme name everything works as >advertised. What I know is this: programs are only executed when they are found in the search path, or when you fully qualify them /dir/dir/program. The ./ refers to the current directory, which apparently is enough qualification for Linux. One of the reasons for this is when people play around with programs that are named after existing programs/commands, e.g. ls If you want to run your own ls, you need to specify that. This can happen when someone wants to work on a development version of a system command. Paul )0(---)0( Wisdom is as rare as diamond )0([[EMAIL PROTECTED]]-)0( http://nlpagan.net - ICQ 147208 Registered Linux User 174403 Linux tips at http://nlpagan.net/linux.htm
Re: [newbie] Command execution
Barry Winch wrote: > > Can someone please explain the concept behind ./ in executing a command. > > If I am in the directory where the programme resides and type the programme > name, I get a: > "bash: programme name: command not found" message This is because your PATH is not defined in your bash_profile. Caution: don't do this for root ! > > If, from the same directory I type ./programme name everything works as > advertised. With ./ you indicate the relative path of the file to your shell. > > Thanks > > Barry An other way to run your file is: /bin/sh myfilename Also: chmod +x myfilename. Also: at the commandline of your file set: PATH=$PATH:. If the script is for yoy personnal usage you can set it in a /home/fred/bin dir and adding it to your PATH varable. Eric -- FRANCE (Be careful, my English can hurt you)
Re: [newbie] Command execution
When you type in a program to be executed, bash will search for the programs based on what's in your PATH environmental variable. If you don't have "./" in your PATH, it won't look there for the program. Just add "./" to your PATH in .bash_profile, it will fix the problem. It's a matter of taste whether you want it to look in the current dir or not I guess. Someting like: vi .bash_profile /PATH PATH=$PATH:$HOME/bin:./ Barry Winch wrote: > Can someone please explain the concept behind ./ in executing a command. > > If I am in the directory where the programme resides and type the programme > name, I get a: > "bash: programme name: command not found" message > > If, from the same directory I type ./programme name everything works as > advertised. > > Thanks > > Barry -- CF 10K Walk: http://members.home.net/jimgbrown/strides.html ___ \/\_\@ / /\ __ ___ ___ [EMAIL PROTECTED] / / /\ / / /\ /--/ //\_\/\_/\ /\/\/\ /\_/\ [EMAIL PROTECTED] /__/ / / // / / / /__/ // / /__/ //_/_/ // // / home: (972)495-3821 \__\/ \/ \/\/\/ \__\/ \/ \__\/ \_\_\/ \/ \/ work: (972)889-4228 Cole's Law: Thinly sliced cabbage.
Re: [newbie] Command execution
When you ask your shell to execute a command without telling him where it is, it looks for it in the directories specified in the $PATH variable ("echo $PATH" to see it). When you specify a directory (here : the . directory [=the current directory]), it will search the command in the specified directory. NB : If you don't want to be annoyed by that, you can add the ./ directory in the $PATH environnement variable. (PATH=$PATH:./) As simple as that. HTH Flupke Barry Winch wrote: > > Can someone please explain the concept behind ./ in executing a command. > > If I am in the directory where the programme resides and type the programme > name, I get a: > "bash: programme name: command not found" message > > If, from the same directory I type ./programme name everything works as > advertised. > > Thanks > > Barry
Re: [newbie] Command execution
Barrywhen you type a command at the prompt a search is made using your 'path'. If the program is not found in the 'path' you get the command not found error. The current directory is not scanned unless it is actually in your 'path', so if it is not you need to tell 'bash' that the program you want to execute is in the current directory by prepending the ./ characters (a single dot means current directory, the / is a seperator). Alan Barry Winch wrote: > > Can someone please explain the concept behind ./ in executing a command. > > If I am in the directory where the programme resides and type the programme > name, I get a: > "bash: programme name: command not found" message > > If, from the same directory I type ./programme name everything works as > advertised. > > Thanks > > Barry
Re: [newbie] Command execution
Barry, in command line terms the . is the functional equivalent of "this directory". The / means the root or main directory off of that indicated. So in effect the ./means the root of the current directory. IN simple terms, it means the directory you are in! The reason you do this is because the program you are executing is not identified as being in the path so you have to rely on your command line arguments to tell the computer where the program you are executing resides. Cheers, Wayne
[newbie] Command Execution
Can someone please explain the concept behind ./ in executing a command. If I am in the directory where the programme resides and type the programme name, I get a: "bash: programme name: command not found" message If, from the same directory I type ./programme name everything works as advertised. Thanks Barry
Re: [newbie] Command execution
> Can someone please explain the concept behind ./ in executing a command. > The . tells the system to look in the current directory, it is needed when you are trying to execute a program or shell script and your working directory is NOT in you path. The PATH environment variable tells the system where to look for programs and files on your system. Joseph H. Perry Oracle DBA Columbus State University 4225 University Ave Columbus, GA 31907-5645 (706) 568-2063 [EMAIL PROTECTED]