From: Garrett on
So, I know that I can do some bash commands in matlab by doing the following...
>> system('C:\cygwin\bin\bash --login -c some_command')

However, I need my command to perform an operation on a certain directory. The simplest example would be getting an 'ls /' to look at the contents of the root directory:

system(['C:\cygwin\bin\bash --login -c ls /'])

The problem is that the command seems to ignore the '/', and prints whatever is in "~\Documents and Settings\myusername\". I tried a few other ways to specify the directory I want it to look at, but to no avail. It seems all commands I try will only work on that directory.

Any ideas, suggestions on what I should do?

Thanks,

Garrett
From: Ashish Uthama on
On Tue, 16 Feb 2010 18:09:07 -0500, Garrett <garrett.spam(a)gmail.com>
wrote:

> So, I know that I can do some bash commands in matlab by doing the
> following...
>>> system('C:\cygwin\bin\bash --login -c some_command')
>
> However, I need my command to perform an operation on a certain
> directory. The simplest example would be getting an 'ls /' to look at
> the contents of the root directory:
>
> system(['C:\cygwin\bin\bash --login -c ls /'])
>
> The problem is that the command seems to ignore the '/', and prints
> whatever is in "~\Documents and Settings\myusername\". I tried a few
> other ways to specify the directory I want it to look at, but to no
> avail. It seems all commands I try will only work on that directory.
>
> Any ideas, suggestions on what I should do?
>
> Thanks,
>
> Garrett

What other ways did you try?

When you specify . does it return the contents of whichever directory you
are in? Try changing MATLAB's dir and retrying.

I am assuming that on a Cygwin shell, ls / works as you expect?