Article View: aus.computers.linux
Article #56442Re: How does one exicute s file inside of Linux?
From: Ken Yap
Date: Sat, 15 Mar 1997 00:00
Date: Sat, 15 Mar 1997 00:00
32 lines
2122 bytes
2122 bytes
In article <01bc310e$11b1cf20$3400a8c0@oldsys>: |Hi There, | |I have been tring to work out how to program in C++ for Linux.. I manage |to write some c++ code call welcome.C via using a editor called emacs... |Then I compiled the code using the g++ command e.g. g++ wlcome.C, it seemed |to complied O.K. and created a file call a.out.. Now I am new to linux |but if I was to run a file say something like a.exe, from DOS, all I would |do is go to the dir where the file was and type the command "a", and the |file would run.. | |How would one setup linux so that the file a.out would run from a certain |dir? In Unix, programs don't have to have any special suffixes to be executable. To run a.out just type a.out to the shell (or to be sure: ./a.out). You can rename a.out to anything you like and it will still be executable. You can tell g++ to put the executable in a particular name with the -o option. Now as for where Unix (or more correctly, the shell in Unix) looks for programs to run, it's controlled by something called a search path. For instance in bash, PATH is set to something like: /bin:/usr/bin:/home/fred:. This says, when you type a.out, try /bin/a.out, then /usr/bin/a.out, then /home/fred/a.out, and finally ./a.out. Very much like the PATH in the M$DOG command.com (which of course took the idea from Unix). All this is explained in any good Unix book.
Technical Details
Message-ID:
<5gdvjf$8h7@degas.syd.dit.csiro.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<01bc310e$11b1cf20$3400a8c0@oldsys>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 102983,a98b80d502683bf9,start
X-Google-Attributes: gid102983,public
From: ken@syd.dit.CSIRO.AU (Ken Yap)
Subject: Re: How does one exicute s file inside of Linux?
Date: 1997/03/15
Message-ID: <5gdvjf$8h7@degas.syd.dit.csiro.au>
X-Deja-AN: 225697017
Sender: ken@syd.dit.csiro.au (Ken Yap)
X-Nntp-Posting-Host: degas.syd.dit.csiro.au
References: <01bc310e$11b1cf20$3400a8c0@oldsys>
X-Face: bak'McMAD{%JrA$mQ(j_Ex_o?a/F8/Nt<W\sbPkh?,)PF7TK1{Lh"HJLuQfhE}(Dj!g:c(U =wh/r[<MJUF}hXzR*URO0e/Lh'mn_YUpU+;ycf6:0>ng*t2KX(NcfGalVs^Ke^C61:F
Organization: CSIRO MIS
Reply-To: ken@syd.dit.csiro.au (Ken Yap)
Newsgroups: aus.computers.linux