help-octave
[Top][All Lists]
Advanced

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

Distinguish between octave an non-octave argv?


From: Judd Storrs
Subject: Distinguish between octave an non-octave argv?
Date: Tue, 17 May 2011 10:34:29 -0400

Hi,

I'm trying to separate octave vs non-octave command line parameters but it seems more difficult than necessary, so I could be missing something. For example, consider this simple script (./test-script):

./test-script.m:
#!/usr/bin/octave -qf
argv

then:

$ ./test-script.m test
ans =
{
  [1,1] = test
}

which I expect. But things are different when no parameters are provided:

$ ./test-script.m 
ans =
{
  [1,1] = -qf
  [2,1] = ./test-script.m
}

So, a simple test that argv() is zero doesn't work. I'm inclined to see this as a bug, but I wanted to make sure I'm not missing something before I start working on a patch. Is there some other easy way to test that no command line parameters were given to the script?


--judd


reply via email to

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