[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
octave2.9 in scripts and curly braces
From: |
John W. Eaton |
Subject: |
octave2.9 in scripts and curly braces |
Date: |
Mon, 11 Dec 2006 12:03:03 -0500 |
On 11-Dec-2006, Eric Chassande-Mottin wrote:
| I'm having a problem with octave 2.9.9 used in a
| script like the one below:
|
| -----------------------------------------------------------------------
| #!/usr/bin/octave2.9 -qf
|
| argument=argv{1};
| -----------------------------------------------------------------------
|
| the script gives the following error:
|
| error: built-in function cannot be indexed with {
| error: evaluating assignment expression near line 3, column 9
| error: near line 3 of file `./test.sh'
|
| curly braces are both used to index the arguments of the script
| and structures in Octave v2.9, hence the error.
|
| is there a simple escape?
In earlier versions of Octave, argv was a variable. In recent 2.9.x
snapshots, all built-in variables have been replaced with functions
(see the NEWS file). So now you must write
args = argv ();
arg1 = args{1};
arg2 = args{2};
...
jwe