Page 1 of 1
how to run program in minix?
Posted: Wed May 07, 2003 3:45 am
by bgcq
i cc main.c to a.out,and command:a.out,then it message:
no found?
Re:how to run program in minix?
Posted: Wed May 07, 2003 4:09 am
by Beyond Infinity lazy
hmm... what do you do? you compile a file called main.c to a.out and then you type in: a.out? Did I get this right?
If so, no wonder why it doesn't work. You have to compile and link your file prior to executing it.
Pls provide yourself with some good books about programming and linking and so forth.
Re:how to run program in minix?
Posted: Wed May 07, 2003 9:23 am
by Curufir
Current directory isn't included in your path (For very good security reasons).
Use either:
./a.out if your current directory is where a.out is.
or:
/full path to directory/a.out to be independent of your current directory.
or:
A combination of the two if you want to get fancy
.
Simply typing a.out at the command line will cause the shell to search directories in your path for the program. IIRC these are /usr/bin, /bin and /usr/local/bin.
For information's sake:
./ represents your current directory.
../ represents the directory above your current directory
/ represents the top level directory of the root filesystem
The alternative to remembering that is to put ./ in your path (This will cause the current directory to be searched when you issue a command), but this is a security hazard if you are planning on having more than one person using the system.
You should be able to check your path by typing
echo $PATH, and edit it from the shell's config file (I can't remember what Minix calls them, it might be .shrc in your home directory).
If you already knew all that then maybe someone else will find it useful, it really is very basic Unix stuff.
Re:how to run program in minix?
Posted: Thu May 08, 2003 6:16 am
by Pype.Clicker
if you really need '.' to be in the path and don't want to be fooled by another user that would hijack sensible programs like "passwd", you can
- go to your home directory before you use sensible programs
- put '.' at the *end* of your path, so that any system locations like /bin, /sbin ... is searched first ...
or am i completely wrong ?