Octave commands can be saved in a file and evaluated by loading the file using
For instance, let
hello.m be the text file containing two lines (the first line is a comment)
# my first Octave program disp('Hello, World!')
If you type
source hello.m at an Octave command prompt you will get
>> source hello.m Hello, World!
Note that a script file doesn't necessarily have to have the extension