If you are not learning Fortran, skip this section.
In this exercise you will create a simple Fortran program, compile it, and execute it. For this purpose, you will use the emacs editor to create the source program. So start emacs with the file hello.f.
emacs hello.f &In the emacs window, copy the following program:
<Tab>WRITE(*,*)'Hello, world.' <Tab>ENDThe notation <Tab> means to hit the Tab key at the beginning of the line. (Don't type the characters <Tab>.) That will assure that each line starts in the correct column for Fortran. Be sure to get all of the punctuation right.
Then when you think your program is correct, save the file. Do not exit emacs yet, however. Instead, bring the terminal window into view again and check the file with more to be sure it is what you expected. Then compile it with the command
f77 hello.f -o helloThe command causes the program hello.f to be compiled and linked. The result of this operation is placed in an executable file called hello.
If the compilation is unsuccessful, return to the emacs window and fix your program. Save the result and rerun the compilation.
When the compilation is successful, run your program with the command
helloThe result should be the message, “Hello, world.”
When you are finished, exit emacs.
A little more information about the f77 command is found in the chapter “More Unix Utilities,”