Consider the following directory structure.
$tree dir1
dir1
|-- dir2
| `-- scriptA.m
|-- script1.m
|-- script2.m
`-- script3.m
where the files are defined as
$cat dir1/script1.m
1;
a=1
$cat dir1/script2.m
1;
b=2
$cat dir1/script3.m
1;
script1;
script2;
c=a+b
$cat dir1/dir2/scriptA.m
1;
../script1;
../script2;
d=2*a+b
In general dir1/script3.m depends upon the functions/variables
defined in
dir1/script1.m, dir1/script2.m.
dir1/dir2/scriptA.m depends upon the functions/variables defined in
dir1/script1.m, dir1/script2.m but conflicts with dir1/script3.m.
I am able to execute dir1/script3.m
$cd dir1
$octave -q
octave:1> script3
a = 1
b = 2
c = 3
octave:2> exit
but not dir1/dir2/scriptA.m.
$cd ..
$cd dir1/dir2
$octave -q
octave:1> scriptA
parse error near line 2 of
file /home/rajulocal/work/octave/dir1/dir2/scriptA.m
syntax error
../script1;
^
parse error near line 2 of
file /home/rajulocal/work/octave/dir1/dir2/scriptA.m
syntax error
../script1;
^
error: near line 2 of file `/home/rajulocal/work/octave/dir1/dir2/
scriptA.m'
octave:1>
Is there any way to overcome this problem and be able to source
specific
files from other directories? I do not want to use addpath and add
dir1 to
the list of directories for searching the functions since that would
add
dir1/script3.m besides dir1/script1.m, dir2/script2.m as well. I
want to
have access only to dir1/script1.m, dir1/script2.m but not to
dir1/script3.m
Any ideas/comments/suggestions regarding this issue are very
welcome. I am
using Debian Etch, octave 3.0.0-9
thanks
raju