print function executes index.m in CWD

Ben Abbott bpabbott at mac.com
Fri Sep 5 20:50:24 CDT 2008


On Sep 5, 2008, at 9:40 PM, Dmitri A. Sergatskov wrote:

> On Fri, Sep 5, 2008 at 8:33 PM, Ben Abbott <bpabbott at mac.com> wrote:
>>
>> On Sep 5, 2008, at 9:27 PM, Dmitri A. Sergatskov wrote:
>>
>>> I think I know what happened.
>>> When I have index.m in the current directory it
>>> shadows off the index.m function from strings
>>> package.
>>> The strings package (and function index()) is being
>>> used by octaverc.
>>>
>>> I do not know what the situation with Matlab.
>>> Does it have index.m somewhere (I cannot find it on the web)?
>>> Does it have the pernicious feature to execute index.m
>>> in current directory (or perhaps in all directories in the path)?
>>>
>>> We definitely have a conflict here and I do not know what is the  
>>> best
>>> way to solve it: do we rename index() function into something else
>>> (I would suggest idx())?
>>>
>>> Sincerely,
>>>
>>> Dmitri.
>>> --
>>
>>
>> in Matlab 2008b
>>
>>>> which index
>> 'index' not found.
>>>>
>>
>> Matlab will search the pwd prior to the path.
>>
>> I'd suggest you rename *your* file to something other than index.m.
>>
>
> Than I do not understand why do we need the magic with executing  
> index.m
> in the current directory.

Are you asking with respect to the way unix shells work?

Octave requires that the pwd to lead in the path for compatibility  
with Matlab ... it is also needed to overload Octave's m-files and (in  
part) to run scripts in the pwd.

Ben


More information about the Bug-octave mailing list