|
From: | David Grundberg |
Subject: | Re: executable scripts and arguments |
Date: | Mon, 08 Feb 2010 14:52:51 +0100 |
User-agent: | Thunderbird 2.0.0.23 (X11/20090812) |
Dupuis wrote:
Hello, I'm "hit" by the "shebang" expansion problem as explained at http://www.in-ulm.de/~mascheck/various/shebang/#details, that is, I created a stand alone octave script with as first line #!/usr/bin/octave --no-init-file --persist The problem is that the program is called with argv[0] = /usr/bin/octave argv[1] = "--no-init-file --persist" argv[2] = the name of the script This way, octave returns an error message because it doesn't understand argv[1], which results from the concatenation of the two intended args. Did someone already succeed in avoiding this problem ? Regards Pascal
There is a limitation in how shebang interpretation works, like you discovered. This is documented in the Octave manual:
http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html#Executable-Octave-ProgramsYou can supply only one argument in the shebang, the 2nd argument is the interpreter file. Unfortunately neither --no-init-file or --persist has short option flags. One solution would be to write a wrapper that adds these arguments.
Either that or use #!/usr/bin/octave -f and add a 'keyboard' call at the end of the script. David
[Prev in Thread] | Current Thread | [Next in Thread] |