help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Executable octave program


From: Kai Torben Ohlhus
Subject: Re: Executable octave program
Date: Thu, 21 Mar 2019 21:28:46 +0100

On Thu, Mar 21, 2019 at 4:47 PM François PH Lapointe <address@hidden> wrote:
Good day everyone,

Base on the link
we could run an executable octave program directly from Unix command line. It should run the program in octave and then exit, right?! It should be similar to the example as 
#! octave-interpreter-name -q -f # comment
for which we are replacing 'octave-interpreter-name'  by '/usr/local/bin/octave’ . However, it does not work, or even with 

$ octave --exec-path /home/flapo/src/pism-dev4/aew4/Ref_runs/m2.m

with m2.m as an executable file similar to
#! octave-interpreter-name -qf
# a sample Octave program
printf ("Hello, world!\n");
Basically, I intend to use a huge bash script, mainly in ‘awk’, with one line for executing an octave program, exit octave, and then continuing through the bash script, all automatically. Am I using the right command script or it should be something different? 

Thank you very much for your help…

François PH Lapointe


Dear François PH Lapointe,

If your working Octave interpreter is located at "/usr/local/bin/octave" then the following should work:

``` Start file octave_test.sh
#!/usr/local/bin/octave -qf

# a sample Octave program
printf ("Hello, world!\n");
``` End file

From the console (make file executable and run it):

   $ chmod u+x octave_test.sh
   $ ./octave_test.sh
   Hello, world!

Does this work?

Best,
Kai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]