[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Executing octave from Octave.app (Macintosh)
From: |
Vic Norton |
Subject: |
Re: Executing octave from Octave.app (Macintosh) |
Date: |
Wed, 3 Oct 2007 12:57:33 -0400 |
Duhhhhh!!! That works fine for me, John. Thanks!!!
I had been doing
$ cd /Applications/Octave.app/Contents/Resources/bin
$ sudo ln -s octave /usr/local/bin
and that doesn't work because
$ ./octave
won't even work from this directory. I needed the complete octave
path for a successful link. Just as you said
$ cd /usr/local/bin
$ sudo ln -s /Applications/Octave.app/Contents/Resources/bin/octave
Of course an old /usr/local/bin/octave must be trashed before this
last command can work.
BTW, the -q flag doesn't work for me. I always see the message at
startup, regardless of the -q, unless I'm running octave from perl.
Regards,
Vic
On Oct 3, 2007, at 12:08 PM, John W. Eaton wrote:
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