|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
octave shebangI'm looking for an octave shebang which doesn't depend on where octave
is installed but instead picks it up from the path. This is the best I came up with: #!/bin/sh cat <<EOF | octave -q This works even without the final EOF on bash (OS X and Linux) and ksh (IRIX). Note that the following works from the command line, but not as #! /usr/bin/env octave -q Any other suggestions? Thanks, - Paul ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html ------------------------------------------------------------- |
|
|
Re: octave shebangUnfortunately, there isn't any easy way around this. Most UNIX shells
pass the argument "octave -q" as a string to env, instead of splitting it into two. The page at http://www.in-ulm.de/~mascheck/various/shebang/ gives an overview of the state of things. Regards Stéfan On Wed, Jul 13, 2005 at 02:12:12AM -0400, Paul Kienzle wrote: > I'm looking for an octave shebang which doesn't depend on where octave > is installed but instead picks it up from the path. > > This is the best I came up with: > > #!/bin/sh > cat <<EOF | octave -q > > This works even without the final EOF on bash (OS X and Linux) and ksh > (IRIX). > > Note that the following works from the command line, but not as #! > > /usr/bin/env octave -q > > Any other suggestions? > > Thanks, > > - Paul > ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html ------------------------------------------------------------- |
|
|
Re: octave shebangOn Wed, 13 Jul 2005, Stefan van der Walt wrote:
>> I'm looking for an octave shebang which doesn't depend on where octave >> is installed but instead picks it up from the path. I assume this is for portability reasons. It might be good to use an install script. One way would be to make scripts without a first line, then have something like this generate the initial line for every script: echo "#\!`which octave` -q" Or, you might use perl or sed to change the first line if it doesn't match the path to Octave. If you can assume that the user has root permissions, you can write the scripts to point to /usr/local/bin/octave, say, and if octave is actually installed elsewhere, write a symbolic link in /usr/local/bin: ln -s `which octave` /usr/local/bin/octave I think that would create the correct link. Mike ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html ------------------------------------------------------------- |
| Free embeddable forum powered by Nabble | Forum Help |