[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
function syntax versus shell command syntax
From: |
Thorsten Meyer |
Subject: |
function syntax versus shell command syntax |
Date: |
Sat, 06 Dec 2003 22:48:09 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030425 |
Hi there,
in octave the general syntax for function calls is
my_function(parameter, ...)
There are, however, some functions like load, gplot and more which
alternatively allow to be called in a more shell like way, e.g.
load -force -ascii data
Still, these function also allow to be called like this:
load("-force", "-ascii", "bla")
Is there a way to define a function that behaves in the same way, i.e.:
if octave gets an input line like
my_function one two three
it interprets it as
my_function("one", "two", "three")
i.e., take everything between the starting keyword and the end of line
(or colon or semicolon) and feed it to the function given by the keyword
as a list of strings (without any variable interpolation in the perl
sense to keep it simple).
This way one could write nice wrappers for shell commands like e.g.
ghostview.
(I have a function ghostview.m but keep forgetting that I am not on the
shell level and write ghostview mypicture.eps instead of
ghostview("mypicture.eps"))
thanks
Thorsten
-------------------------------------------------------------
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
-------------------------------------------------------------
- function syntax versus shell command syntax,
Thorsten Meyer <=