[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
octave scripts -- startup message for interactive session only (also, o
From: |
Carnë Draug |
Subject: |
octave scripts -- startup message for interactive session only (also, octave and shebang lines) |
Date: |
Sat, 17 Jan 2015 21:36:10 +0000 |
When calling a program written in Octave it always prints the startup
message.
$ cat an_octave_program
#!/usr/local/bin/octave
printf ("hello\n");
$ chmod a+x an_octave_program
$ ./an_octave_program
GNU Octave, version 3.8.2
Copyright (C) 2014 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.
Octave was configured for "x86_64-unknown-linux-gnu".
Additional information about Octave is available at http://www.octave.org.
Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html
Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.
hello
$
I am thinking that such startup message should not be displayed unless
there is a interactive session. I am aware of the "--quiet" option but
in this cases, it should not be necessary.
A problem is that when I write such scripts, I set the shebang line to
"#!/usr/local/bin/octave -qf". However, people that I share them with, will
have octave somewhere else (usually in "/usr/bin" if they didn't build it
from source). An easy solution for this is to set "#!/usr/bin/env octave"
but this means that I can't use the "-qf" options anymore and the program
that was supposed to print a table of numbers is now also printing license
details.
Would it be possible to implicitely set the "--quiet" option when running
an Octave program? Or even better, only have startup message after
starting the interactive session? I'd guess the later would make things
easier for the case when starting a script with the "--persist" option.
Python seems to already do this. If I start python on the command line I
get three lines of build information but not when running a Python script.
$ python
Python 2.7.8 (default, Oct 18 2014, 12:50:18)
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
$ cat a_python_program
#!/usr/bin/python
print "hello"
$ ./a_python_program
hello
Carnë
- octave scripts -- startup message for interactive session only (also, octave and shebang lines),
Carnë Draug <=