[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Executing octave from Octave.app (Macintosh)
From: |
John W. Eaton |
Subject: |
Re: Executing octave from Octave.app (Macintosh) |
Date: |
Wed, 03 Oct 2007 12:08:10 -0400 |
On 3-Oct-2007, Thomas Treichl wrote:
| Vic Norton schrieb:
| > How to get the octave in Octave.app to execute from terminal:
| > $ octave
| > and to be called by the shebang line
| > #!/usr/local/bin/octave.
| >
| > Put the two-line, shell-script "octave"
| > #!/bin/sh
| > /Applications/Octave.app/Contents/Resources/bin/octave
| > in /usr/local/bin and make it executable.
| >
| > I guess this should be obvious, but it wasn't obvious to me. I've
| > wasted a lot of time trying to get symbolic links to work.
| >
| > Regards,
| >
| > Vic
Why doesn't a symbolic link work for this purpose?
I think you should be able to do
cd /usr/local/bin
ln -s /Applications/Octave.app/Contents/Resources/bin/octave
and then create a script with the contents (say doit):
#! /usr/local/bin/octave -qf
1 + 1
and then
chmod a+x doit
./doit
Or you can avoid the symbolic link if you start your scripts with
#! /Applications/Octave.app/Contents/Resources/bin/octave -qf
but people will have to change that when they run your code on a
system that has Octave in a different directory.
If you don't know where Octave will be installed and you want your
scripts to be somewhat more portable, you could maybe use something
like
#! /usr/bin/env octave
instead, but unfortunately, adding arguments after the octave command
doesn't work as you might expect when it is used as a #! line.
jwe