help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Executable Octave script: odd behavior when called with option ‘-dis


From: Bernd Lütkenhöner
Subject: Re: Executable Octave script: odd behavior when called with option ‘-display’
Date: Sat, 15 Sep 2018 18:23:37 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hello Kai,

My real software is, of course, much more complicated (with thousands of lines
of code, mainly developed under MATLAB). The idea is to call this software from
an executable Octave script as:

   mySoftware(argv())

The function 'mySoftware' then interpretes argv. Everything works fine, except
for the case that the Octave script is called with the option '-display xyz'.
Therefore I stripped down my software until I finally found out that the problem
already arises in the trivial script 'hello' (see my originally posting).
Calling my script 'hello' with options (whatever they are) should have no effect
at all. However, the option '-display xyz' suppresses the output 'Hello world'.
This is quite odd in my opinion.

Kind regards
Bernd



Am 15.09.2018 um 17:59 schrieb Kai Torben Ohlhus:
> On Fri, Sep 14, 2018 at 10:31 PM Bernd Lütkenhöner <address@hidden
> <mailto:address@hidden>> wrote:
> 
>     Hi
> 
> 
>     Trying to call an executable Octave script with the option -display I 
> found
>     an odd behavior. This behavior can already be found in the trivial script
>     ‘hello’:
> 
>     #! /usr/bin/octave -qf
>     disp('Hello world');
> 
> 
>     Calling this script as
> 
>     ./hello
>     ./hello -disp xyz
>     ./hello -display
> 
> 
>     yields, as expected, the output ‘Hello world’. However, no output appears 
> if
>     I call the script as
> 
>     ./hello -display xyz
> 
>     I could easily avoid the problem by changing, in my software, the name of
>     the option (e.g. ‘disp’ instead of ‘display’). However, I am curious to
>     understand what goes wrong.
> 
>     My Octave version is 4.2.2 (running under Ubuntu).
> 
> 
>     ---
>     Bernd
> 
> 
> Dear Bernd,
> 
> What do you expect to happen when you call "./hello" with the "-disp" or
> "-display" argument?  At least both are not Octave command line arguments [1],
> thus I cannot say which program interprets them.  Maybe you take a close look 
> at
> how to run proper Octave M-Files from command line.  For a script "hello.m" 
> only
> containing the "disp('Hello world');" line you can call
> 
> /user/bin/octave -qf hello.m
> 
> HTH,
> Kai
> 
> [1]: https://octave.org/doc/v4.2.2/Command-Line-Options.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]