LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-14-2008, 05:20 PM   #1
tuas
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Rep: Reputation: 0
compile fortran using g77 into executable binary image


Hi all,

I am kind of new to fortran Unix (and other OS)
I am compiling a source say abc.f
$g77 -o abc abc.f
By then, I have an executable abc binary file
After that, I change the mode of abc into executable
chmod 775 abc

In order to run the image, I must type
$./ abc

I am very very new to Unix/Linux, please anyone could teach me how to convert this binary image into some "executable image" that can run without "./". I just want to type abc then the abc program will be called.
$abc

Thanks and regards,
Have a good day everyone!

Last edited by tuas; 11-14-2008 at 05:23 PM.
 
Old 11-14-2008, 06:59 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,950
Blog Entries: 5

Rep: Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755
In UNIX/Linux executables are searched for based on the PATH variable.

The PATH variable has a series of directories separated by colon. You can see what your PATH is currently defined as by typing:
echo $PATH

You should see something like:
/bin:/usr/bin:/usr/local/bin

When you type "abc" it looks in the directories in the order they appear in your PATH. So it would first look for /bin/abc then /usr/bin/abc and finally in /usr/local/bin/abc.

When you type "./" you're saying "this directory" so you COULD simply add it to PATH by typing:
PATH=$PATH:./

But really "." is a short cut to current directory so you COULD simply add it to PATH by typing:
PATH=$PATH:.

However that you should NOT do either of those for security reasons. What you should do is put abc in a directory you use for that purpose then add that directory in your path.
For example if "./" were your home directory (/home/<yourusername>) then you might want to do:
PATH=$PATH:/home/<yourusername>

Many people prefer to have separate bin subdirectory so you might want to instead type:
mkdir /home/<yourusername>/bin
PATH=$PATH:/home/<yourusername>/bin

You can make the change permanent by editing your .bashrc or .bash_profile file.

Typing "man bash" will give you a wealth of information about many subjects including the standard variables like $PATH, $HOME etc...
 
Old 11-21-2008, 10:03 AM   #3
tuas
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Hi jlightner,
Thank you very much for your reply. It works 100%..
I am very happy now..

Regards,
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
g77 in gcc 4.1.0 not found only gfortran fortran 95 compiler! I need fortran 77. TheBrick Linux - Software 3 07-04-2007 06:39 AM
Compiling Fortran program by g77 akillam Linux - Software 1 10-16-2006 05:02 AM
Compiling with g77 thank you very much...but I solved compile with g77 gambato79 Fedora 9 07-19-2005 11:35 AM
compile( gcc-g77) fortran with fedora core 3 gambato79 Programming 1 05-06-2005 12:49 PM
G77 Fortran included in Fedora 2 ? aeslin Linux - Software 1 11-08-2004 07:27 AM


All times are GMT -5. The time now is 08:34 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration