Yes, of course you can write an Octave program. Like so:
$ cat octave_program
#!/usr/bin/env octave
## Never forget your licence at the top of the files.
1;
function [rv] = main (argv)
disp ("hello world");
rv = 0;
return;
endfunction
main (argv);
$ chmod a+x octave_program # add executable permissions
$ ./octave_program
hello world
There's a couple of things important for an Octave program:
the first statement cannot be a function declaration. In all my programs, the first statements are loading of necessary packages. If you don't have packages, it is common to use 1;
a she-bang line. That's the first line of your program which tells you how to run your program. If you know where Octave will be installed, you can use #!/usr/bin/octave but using #!/usr/bin/env octave will be more portable and flexible.
your program needs executable permissions
octave -q script.mshould work with "quiet" mode, no extra garbage dumped by octave.octaveon the command line if you do it properly./usr/binwritten on those languages.